首页 > 解决方案 > 在 Kubernetes 上运行 Spark 时,是否可以作为另一个用户以 root 身份运行?

问题描述

当我向 Kubernetes 提交 Spark 作业时,容器中的所有内容都以 root 身份运行。是否可以以其他用户身份运行作业?

当我在客户端模式下提交作业时,驱动程序以提交它的用户身份运行,但执行程序以 root 身份运行,这可能导致访问执行程序创建的文件时出现文件访问问题。

标签: apache-sparkkubernetes

解决方案


Unless the full customization of the K8s Pod is supported by Spark on K8s (in particular runAsUser feature) the only ways to control it (as I see for the moment) are: - Build docker image specifying USER in Dockerfile - Use some advanced K8s tools/controllers, eg Argo Events - Customize spark-submit or submit Spark Pods directly as Kubernetes Pods through K8s APIs

Hope to see some improvements coming with Spark v3.0.0 soonish though.


推荐阅读