如何使用 Kubernetes 在 Spark 中设置临时存储

jra*_*ary 5 apache-spark kubernetes

使用 Kubernetes 集群运行 spark 作业时,我们收到以下错误:

2018-11-30 14:00:47 INFO  DAGScheduler:54 - Resubmitted ShuffleMapTask(1, 58), so marking it as still running.
2018-11-30 14:00:47 WARN  TaskSetManager:66 - Lost task 310.0 in stage 1.0 (TID 311, 10.233.71.29, executor 3): ExecutorLostFailure (executor 3 exited caused by one of the running tasks) Reason: 
The executor with id 3 exited with exit code -1.
The API gave the following brief reason: Evicted
The API gave the following message: The node was low on resource: ephemeral-storage. Container executor was using 515228Ki, which exceeds its request of 0. 
The API gave the following container statuses:
Run Code Online (Sandbox Code Playgroud)

如何配置作业以便我们可以增加每个容器的临时存储大小?

我们使用 spark 2.4.0 和 Kubernetes 1.12.1

spark提交选项如下

--conf spark.local.dir=/mnt/tmp \
--conf spark.executor.instances=4 \
--conf spark.executor.cores=8 \
--conf spark.executor.memory=100g \
--conf spark.driver.memory=4g \
--conf spark.driver.cores=1 \
--conf spark.kubernetes.memoryOverheadFactor=0.1 \
--conf spark.kubernetes.container.image=spark:2.4.0 \
--conf spark.kubernetes.namespace=visionlab \
--conf spark.kubernetes.authenticate.driver.serviceAccountName=spark \
--conf spark.kubernetes.container.image.pullPolicy=Always \
--conf spark.kubernetes.driver.volumes.persistentVolumeClaim.myvolume.options.claimName=pvc \
--conf spark.kubernetes.driver.volumes.persistentVolumeClaim.myvolume.mount.path=/mnt/ \
--conf spark.kubernetes.driver.volumes.persistentVolumeClaim.myvolume.mount.readOnly=false \
--conf spark.kubernetes.executor.volumes.persistentVolumeClaim.myvolume.options.claimName=pvc \
--conf spark.kubernetes.executor.volumes.persistentVolumeClaim.myvolume.mount.path=/mnt/ \
--conf spark.kubernetes.executor.volumes.persistentVolumeClaim.myvolume.mount.readOnly=false
Run Code Online (Sandbox Code Playgroud)

Ric*_*ico 0

看起来您的工作可能会0在临时存储的 Pod 中发出请求。如果您查看文档,您会发现临时存储是节点上根磁盘的一部分。所以你可以尝试指定一个hostPath安装。

/mnt/tmp我的猜测是 PVC 发生了一些事情,并且容器正在使用临时卷,或者如果您指定卷,则可能需要 hostPath 和 PVC (for )。我会检查:

$ kubectl describe pvc
$ kubectl describe pv
Run Code Online (Sandbox Code Playgroud)

截至撰写本文时, Spark 驱动程序中没有选项可以发出 KubernetesRequest以限制临时存储。