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

标签 apache-spark kubernetes pyspark kubernetes-pod

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

我希望我的所有驱动程序/执行程序 pod 都生成到具有特定污点的节点上。因此,我想指定将直接注入(inject)到 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

但是,这种容忍度永远不会添加到已启动的驱动程序 pod 中。目前有办法解决这个问题吗?

作为引用,这里是完整的 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

最佳答案

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

  1. 您的 pod_template.template 应该在末尾有 .yaml
  2. 您没有在 spark-submit 命令或 pod_template.template.yaml 中指定 spark.kubernetes.driver.pod.name > 以元数据
  3. 的形式
  4. 在为 spark.kubernetes.driver.podTemplateFile=spark.kubernetes.executor.podTemplateFile= 指定路径时,您使用了双 // >
  5. 您应该将所有的容忍度都放在""中,例如:effect: "NoSchedule"

如果有帮助,请告诉我。

关于apache-spark - 用于在 Kubernetes 上运行 Spark 时指定容忍度的 Pod 模板,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58169780/

相关文章:

azure - 我可以在 Azure 环境之外使用 Azure Synapse 功能吗?

python - PySpark:如何将具有 SparseVector 类型列的 Spark 数据帧写入 CSV 文件?

python - 如何在 Apache Spark (pyspark) 中使用自定义类?

python - PySpark 按值分解键并保留 LDA 模型的重复项

Kubernetes kubectl 更新服务选择器

mongodb - 在 kubernetes 内运行 mongodb - azure aks 失败

scala - 如何重新整理Spark数据框中的行?

apache-spark - Spark - 如何在生产中使用训练有素的推荐模型?

apache-spark - Pyspark 中的表格显示来自 CSV 文件的标题

python - 如何在pyspark数据框中转换 "DD/MM/YYYY"格式的日期?