用于在 Kubernetes 上运行 Spark 时指定容忍度的 Pod 模板

toe*_*erq 3 apache-spark kubernetes pyspark kubernetes-pod

我在尝试通过 Kubernetes 调度程序启动 Spark 作业时遇到一些问题。

我希望所有驱动程序/执行程序 Pod 都生成到具有一定污点的节点上。因此,我想指定将直接注入到 Pod 配置文件中的容忍度。目前没有直接从spark-submit命令默认的方式

根据thisthis,用户应该能够指定一个 pod 模板,该模板可以使用以下参数进行设置:spark.kubernetes.driver.podTemplateFilespark.kubernetes.executor.podTemplateFile

spark-submit我尝试使用以下文件在命令中指定这些参数:

pod_template.template

apiVersion: v1
kind: Pod
spec:
  tolerations:
  - effect: NoSchedule
    key: dedicated
    operator: Equal
    value: test
Run Code Online (Sandbox Code Playgroud)

然而,这种容忍永远不会被添加到启动的驱动程序窗格中。目前有办法解决这个问题吗?

作为参考,这里是完整的 Spark-submit 命令:

/opt/spark/bin/spark-submit --name spark-pi --class org.apache.spark.examples.SparkPi --conf spark.kubernetes.executor.volumes.persistentVolumeClaim.persistent.options.claimName=pvc-storage --conf spark.kubernetes.executor.volumes.persistentVolumeClaim.persistent.mount.subPath=test-stage1/spark --conf spark.executor.memory=1G --conf spark.executor.instances=1 --conf spark.kubernetes.driver.volumes.persistentVolumeClaim.persistent.mount.subPath=test-stage1/spark --conf spark.kubernetes.executor.limit.cores=1 --conf spark.kubernetes.authenticate.driver.serviceAccountName=spark --conf spark.kubernetes.namespace=test-stage1 --conf spark.kubernetes.driver.volumes.persistentVolumeClaim.persistent.mount.path=/persistent --conf spark.kubernetes.driver.limit.memory=3G --conf spark.kubernetes.executor.volumes.persistentVolumeClaim.persistent.mount.path=/persistent --conf spark.submit.deployMode=cluster --conf spark.kubernetes.container.image=<SPARK IMAGE> --conf spark.master=k8s://https://kubernetes.default.svc --conf spark.kubernetes.driver.limit.cores=1  --conf spark.executor.cores=1 --conf spark.kubernetes.driver.volumes.persistentVolumeClaim.persistent.options.claimName=pvc-storage --conf spark.kubernetes.container.image.pullPolicy=Always --conf spark.kubernetes.executor.podTemplateFile=//opt/pod_template.template --conf spark.kubernetes.driver.podTemplateFile=//opt/pod_template.template local:///opt/spark/examples/src/main/python/pi.py 100
Run Code Online (Sandbox Code Playgroud)

OhH*_*ark 6

我检查了各种文档,发现这里可能配置错误的一些东西:

  1. 你的最后pod_template.template应该有.yaml
  2. 您没有spark.kubernetes.driver.pod.namespark-submit命令中指定,也没有以pod_template.template.yaml以下形式指定metadata
  3. 在为和//指定路径时使用了 doublespark.kubernetes.driver.podTemplateFile=spark.kubernetes.executor.podTemplateFile=
  4. 您应该将所有的容忍度放入 中"",例如:effect: "NoSchedule"

请告诉我这是否有帮助。