diff --git a/core/src/main/scala/org/apache/spark/deploy/SparkSubmit.scala b/core/src/main/scala/org/apache/spark/deploy/SparkSubmit.scala
index b524603f691a8..c030992c6d311 100644
--- a/core/src/main/scala/org/apache/spark/deploy/SparkSubmit.scala
+++ b/core/src/main/scala/org/apache/spark/deploy/SparkSubmit.scala
@@ -653,7 +653,9 @@ object SparkSubmit extends CommandLineUtils {
if (args.isPython) {
childArgs ++= Array("--primary-py-file", args.primaryResource)
childArgs ++= Array("--main-class", "org.apache.spark.deploy.PythonRunner")
- childArgs ++= Array("--other-py-files", args.pyFiles)
+ if (args.pyFiles != null) {
+ childArgs ++= Array("--other-py-files", args.pyFiles)
+ }
} else {
childArgs ++= Array("--primary-java-resource", args.primaryResource)
childArgs ++= Array("--main-class", args.mainClass)
diff --git a/docs/running-on-kubernetes.md b/docs/running-on-kubernetes.md
index 191ec8454b7b2..68a9334b29fc2 100644
--- a/docs/running-on-kubernetes.md
+++ b/docs/running-on-kubernetes.md
@@ -770,6 +770,22 @@ from the other deployment modes. See the [configuration page](configuration.html
myIdentifier
. Multiple node selector keys can be added by setting multiple configurations with this prefix.
+
spark.executorEnv.[EnvironmentVariableName]
EnvironmentVariableName
to
+ the Executor process. The user can specify multiple of these to set multiple environment variables.
+ spark.kubernetes.driverEnv.[EnvironmentVariableName]
EnvironmentVariableName
to
+ the Driver process. The user can specify multiple of these to set multiple environment variables.
+