Skip to content
This repository was archived by the owner on Jan 9, 2020. It is now read-only.
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
dynamic allocation: docs
  • Loading branch information
foxish committed May 14, 2017
commit 93a181596b7e4f4180c4faaf5a63ab440c6f85e0
59 changes: 57 additions & 2 deletions docs/running-on-kubernetes.md
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ from the other deployment modes. See the [configuration page](configuration.html
<td>
The namespace that will be used for running the driver and executor pods. When using
<code>spark-submit</code> in cluster mode, this can also be passed to <code>spark-submit</code> via the
<code>--kubernetes-namespace</code> command line argument. The namespace must already exist.
<code>--kubernetes-namespace</code> command line argument.
</td>
</tr>
<tr>
Expand All @@ -208,6 +208,30 @@ from the other deployment modes. See the [configuration page](configuration.html
<a href="https://docs.docker.com/engine/reference/commandline/tag/">Docker tag</a> format.
</td>
</tr>
<tr>
<td><code>spark.kubernetes.shuffle.namespace</code></td>
<td><code>default</code></td>
<td>
Namespace in which the shuffle service pods are present. The shuffle service must be
created in the cluster prior to attempts to use it.
</td>
</tr>
<tr>
<td><code>spark.kubernetes.shuffle.labels</code></td>
<td><code>(none)</code></td>
<td>
Labels that will be used to look up shuffle service pods. This should be a comma-separated list of label key-value pairs,
where each label is in the format <code>key=value</code>. The labels chosen must be such that
they match exactly one shuffle service pod on each node that executors are launched.
</td>
</tr>
<tr>
<td><code>spark.kubernetes.dynamic.allocation.size</code></td>
<td><code>5</code></td>
<td>
Number of executor pods to launch at once in each round of dynamic allocation.
</td>
</tr>
<tr>
<td><code>spark.kubernetes.authenticate.submission.caCertFile</code></td>
<td>(none)</td>
Expand Down Expand Up @@ -382,10 +406,41 @@ from the other deployment modes. See the [configuration page](configuration.html
</tr>
</table>

## Dynamic Executor Scaling

Spark on Kubernetes supports Dynamic Allocation with cluster mode. This mode requires running
an external shuffle service. This is typically a [daemonset](https://kubernetes.io/docs/concepts/workloads/controllers/daemonset/)
with a provisioned [hostpath](https://kubernetes.io/docs/concepts/storage/volumes/#hostpath) volume.
This shuffle service may be shared by executors belonging to different SparkJobs. Using Spark with dynamic allocation
on Kubernetes assumes that a cluster administrator has set up one or more shuffle-service daemonsets in the cluster.

A sample configuration file is provided in `conf/kubernetes-shuffle-service.yaml` which can be customized as needed
for a particular cluster. It is important to note that `spec.template.metadata.labels` are setup appropriately for the shuffle
service because there may be multiple shuffle service instances running in a cluster. The labels give us a way to target a particular
shuffle service.

For example, if the shuffle service we want to use is in the default namespace, and
has pods with labels `app=spark-shuffle-service` and `spark-version=2.1.0`, we can
use those tags to target that particular shuffle service at job launch time. In order to run a job with dynamic allocation enabled,
the command may then look like the following:

bin/spark-submit \
--deploy-mode cluster \
--class org.apache.spark.examples.GroupByTest \
--master k8s://<k8s-master>:<port> \
--kubernetes-namespace default \
--conf spark.app.name=group-by-test \
--conf spark.kubernetes.driver.docker.image=kubespark/spark-driver:latest \
--conf spark.kubernetes.executor.docker.image=kubespark/spark-executor:latest \
--conf spark.dynamicAllocation.enabled=true \
--conf spark.shuffle.service.enabled=true \
--conf spark.kubernetes.shuffle.namespace=default \
--conf spark.kubernetes.shuffle.labels="app=spark-shuffle-service,spark-version=2.1.0" \
examples/jars/spark_examples_2.11-2.2.0.jar 10 400000 2

## Current Limitations

Running Spark on Kubernetes is currently an experimental feature. Some restrictions on the current implementation that
should be lifted in the future include:
* Applications can only use a fixed number of executors. Dynamic allocation is not supported.
* Applications can only run in cluster mode.
* Only Scala and Java applications can be run.
6 changes: 3 additions & 3 deletions resource-managers/kubernetes/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@ important matters to keep in mind when developing this feature.

# Building Spark with Kubernetes Support

To build Spark with Kubernetes support, use the `kubernetes` profile when invoking Maven.
To build Spark with Kubernetes support, use the `kubernetes` profile when invoking Maven. For example, to simply compile
the Kubernetes core implementation module along with its dependencies:

git checkout branch-2.1-kubernetes
build/mvn package -Pkubernetes -DskipTests
build/mvn compile -Pkubernetes -pl resource-managers/kubernetes/core -am -DskipTests

To build a distribution of Spark with Kubernetes support, use the `dev/make-distribution.sh` script, and add the
`kubernetes` profile as part of the build arguments. Any other build arguments can be specified as one would expect when
Expand Down