Skip to content

Commit 1caef0b

Browse files
foxishash211
authored andcommitted
Bumping up kubernetes-client version to fix GKE and local proxy (apache-spark-on-k8s#105)
* Bumping up kubernetes-client version to add fixes * Modify wording * Addressed comments
1 parent bbef2a3 commit 1caef0b

File tree

3 files changed

+31
-3
lines changed

3 files changed

+31
-3
lines changed

docs/running-on-kubernetes.md

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ connect without SSL on a different port, the master would be set to `k8s://http:
5151

5252
Note that applications can currently only be executed in cluster mode, where the driver and its executors are running on
5353
the cluster.
54-
54+
5555
### Adding Other JARs
5656

5757
Spark allows users to provide dependencies that are bundled into the driver's Docker image, or that are on the local
@@ -150,6 +150,34 @@ or `container:`. A scheme of `file:` corresponds to the keyStore being located o
150150
the driver container as a [secret volume](https://kubernetes.io/docs/user-guide/secrets/). When the URI has the scheme
151151
`container:`, the file is assumed to already be on the container's disk at the appropriate path.
152152

153+
### Kubernetes Clusters and the authenticated proxy endpoint
154+
155+
Spark-submit also supports submission through the
156+
[local kubectl proxy](https://kubernetes.io/docs/user-guide/connecting-to-applications-proxy/). One can use the
157+
authenticating proxy to communicate with the api server directly without passing credentials to spark-submit.
158+
159+
The local proxy can be started by running:
160+
161+
kubectl proxy
162+
163+
If our local proxy were listening on port 8001, we would have our submission looking like the following:
164+
165+
bin/spark-submit \
166+
--deploy-mode cluster \
167+
--class org.apache.spark.examples.SparkPi \
168+
--master k8s://http://127.0.0.1:8001 \
169+
--kubernetes-namespace default \
170+
--conf spark.executor.instances=5 \
171+
--conf spark.app.name=spark-pi \
172+
--conf spark.kubernetes.driver.docker.image=registry-host:5000/spark-driver:latest \
173+
--conf spark.kubernetes.executor.docker.image=registry-host:5000/spark-executor:latest \
174+
examples/jars/spark_examples_2.11-2.2.0.jar
175+
176+
Communication between Spark and Kubernetes clusters is performed using the fabric8 kubernetes-client library.
177+
The above mechanism using `kubectl proxy` can be used when we have authentication providers that the fabric8
178+
kubernetes-client library does not support. Authentication using X509 Client Certs and oauth tokens
179+
is currently supported.
180+
153181
### Spark Properties
154182

155183
Below are some other common properties that are specific to Kubernetes. Most of the other configurations are the same

resource-managers/kubernetes/core/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
<name>Spark Project Kubernetes</name>
3030
<properties>
3131
<sbt.project.name>kubernetes</sbt.project.name>
32-
<kubernetes.client.version>1.4.34</kubernetes.client.version>
32+
<kubernetes.client.version>2.0.3</kubernetes.client.version>
3333
</properties>
3434

3535
<dependencies>

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ private[spark] class KubernetesClusterSchedulerBackend(
4444
private val EXECUTOR_MODIFICATION_LOCK = new Object
4545
private val runningExecutorPods = new scala.collection.mutable.HashMap[String, Pod]
4646

47-
private val kubernetesMaster = Client.resolveK8sMaster(sc.master)
47+
private val kubernetesMaster = "https://kubernetes"
4848
private val executorDockerImage = conf.get(EXECUTOR_DOCKER_IMAGE)
4949
private val kubernetesNamespace = conf.get(KUBERNETES_NAMESPACE)
5050
private val executorPort = conf.getInt("spark.executor.port", DEFAULT_STATIC_PORT)

0 commit comments

Comments
 (0)