【问题标题】:unable to mount volume to spark.kubernetes.executor无法将卷挂载到 spark.kubernetes.executor
【发布时间】:2020-03-22 15:18:23
【问题描述】:

我正在尝试使用 kubernetes 在 spark 集群模式下从服务器读取文件,因此我将文件放在所有工作人员上,并使用
val conf = new SparkConf().setAppName("sparksetuptest") .set("spark.kubernetes.driver.volumes.hostPath.host.mount.path", "/file-directory")

这里一切正常,但是当我执行它时显示在特定位置找不到该文件。 所以我用 .set("spark.kubernetes.executor.volumes.hostPath.host.mount.path", "/file-directory") 将目录挂载到执行器 但是现在我无法执行程序,它在获取数据时卡在一个永无止境的过程中。

请提出一些建议,以便我可以使用执行程序挂载我的目录并读取该文件。

【问题讨论】:

  • 你能解决这个问题吗?我对您的解决方案感兴趣。

标签: scala apache-spark kubernetes server data-science


【解决方案1】:

这是来自nfs-example的示例

spark.kubernetes.driver.volumes.nfs.images.options.server=example.com
spark.kubernetes.driver.volumes.nfs.images.options.path=/data

我认为您需要在options.path 下声明要挂载的路径,而spark.kubernetes.driver.volumes.[VolumeType].[VolumeName].mount.path 是容器中的挂载路径

例如:

如果我想在k8s的节点上挂载/home/lemon/data到路径/data的docker容器,VolumeName为exepv,那么

conf.set("spark.kubernetes.executor.volumes.hostPath.exepv.mount.path","/data")
conf.set("spark.kubernetes.executor.volumes.hostPath.exepv.options.path", "/home/lemon/data")

在此之后,您可以在执行器容器中访问路径/data

【讨论】:

  • 我完全按照你说的做了。然而,我仍然遇到同样的问题。我进入我正在运行的容器并直接进入 mountPath 并执行了 ls 并没有找到任何文件...
猜你喜欢
  • 1970-01-01
  • 2021-11-22
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2021-01-22
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多