Skip to content

Commit f14061c

Browse files
wackxudongjoon-hyun
authored andcommitted
[SPARK-30371][K8S] Add spark.kubernetes.driver.master conf
### What changes were proposed in this pull request? make KUBERNETES_MASTER_INTERNAL_URL configurable ### Why are the changes needed? we do not always use the default port number 443 to access our kube-apiserver, and even in some mulit-tenant cluster, people do not use the service `kubernetes.default.svc` to access the kube-apiserver, so make the internal master configurable is necessary。 ### Does this PR introduce any user-facing change? user can configure the internal master url by ``` --conf spark.kubernetes.internal.master=https://kubernetes.default.svc:6443 ``` ### How was this patch tested? run in multi-cluster that do not use the https://kubernetes.default.svc to access the kube-apiserver Closes #27029 from wackxu/internalmaster. Authored-by: xushiwei 00425595 <[email protected]> Signed-off-by: Dongjoon Hyun <[email protected]>
1 parent d4c6ec6 commit f14061c

File tree

3 files changed

+15
-1
lines changed

3 files changed

+15
-1
lines changed

docs/running-on-kubernetes.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -507,6 +507,13 @@ See the [configuration page](configuration.html) for information on Spark config
507507
configuration properties e.g. <code>spark.kubernetes.namespace</code>.
508508
</td>
509509
</tr>
510+
<tr>
511+
<td><code>spark.kubernetes.driver.master</code></td>
512+
<td><code>https://kubernetes.default.svc</code></td>
513+
<td>
514+
The internal Kubernetes master (API server) address to be used for driver to request executors.
515+
</td>
516+
</tr>
510517
<tr>
511518
<td><code>spark.kubernetes.namespace</code></td>
512519
<td><code>default</code></td>

resource-managers/kubernetes/core/src/main/scala/org/apache/spark/deploy/k8s/Config.scala

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,13 @@ private[spark] object Config extends Logging {
3636
.stringConf
3737
.createOptional
3838

39+
val KUBERNETES_DRIVER_MASTER_URL =
40+
ConfigBuilder("spark.kubernetes.driver.master")
41+
.doc("The internal Kubernetes master (API server) address " +
42+
"to be used for driver to request executors.")
43+
.stringConf
44+
.createWithDefault(KUBERNETES_MASTER_INTERNAL_URL)
45+
3946
val KUBERNETES_NAMESPACE =
4047
ConfigBuilder("spark.kubernetes.namespace")
4148
.doc("The namespace that will be used for running the driver and executor pods.")

resource-managers/kubernetes/core/src/main/scala/org/apache/spark/scheduler/cluster/k8s/KubernetesClusterManager.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ private[spark] class KubernetesClusterManager extends ExternalClusterManager wit
5151
"If the application is deployed using spark-submit in cluster mode, the driver pod name " +
5252
"must be provided.")
5353
(KUBERNETES_AUTH_DRIVER_MOUNTED_CONF_PREFIX,
54-
KUBERNETES_MASTER_INTERNAL_URL,
54+
sc.conf.get(KUBERNETES_DRIVER_MASTER_URL),
5555
Some(new File(Config.KUBERNETES_SERVICE_ACCOUNT_TOKEN_PATH)),
5656
Some(new File(Config.KUBERNETES_SERVICE_ACCOUNT_CA_CRT_PATH)))
5757
} else {

0 commit comments

Comments
 (0)