Apache Spark enhanced with native Kubernetes scheduler back-end
Scala Java Python R Shell JavaScript Other
Switch branches/tags
#423 Compare This branch is 510 commits ahead, 881 commits behind apache:master.
Latest commit 4a322ad Aug 17, 2017 @ash211 ash211 committed with mccheah Fix license check (#442)
Required for ./dev/check-license to pass
Failed to load latest commit information.
.github [SPARK-18073][DOCS][WIP] Migrate wiki to spark.apache.org web site Nov 23, 2016
R Preparing Spark release v2.2.0-rc6 Jun 30, 2017
assembly bump to 2.2.0-k8s-0.4.0-SNAPSHOT Aug 10, 2017
bin [SPARK-20613] Remove excess quotes in Windows executable May 5, 2017
build [SPARK-19550][BUILD][CORE][WIP] Remove Java 7 support Feb 16, 2017
common bump to 2.2.0-k8s-0.4.0-SNAPSHOT Aug 10, 2017
conf Update tags (#332) Jul 24, 2017
core bump to 2.2.0-k8s-0.4.0-SNAPSHOT Aug 10, 2017
data [SPARK-16421][EXAMPLES][ML] Improve ML Example Outputs Aug 5, 2016
dev Fix sbt build. (#344) Jul 24, 2017
docs Allow configuration to set environment variables on driver and execut… Aug 9, 2017
examples bump to 2.2.0-k8s-0.4.0-SNAPSHOT Aug 10, 2017
external bump to 2.2.0-k8s-0.4.0-SNAPSHOT Aug 10, 2017
graphx bump to 2.2.0-k8s-0.4.0-SNAPSHOT Aug 10, 2017
launcher bump to 2.2.0-k8s-0.4.0-SNAPSHOT Aug 10, 2017
licenses [MINOR][BUILD] Add modernizr MIT license; specify "2014 and onwards" … Jun 4, 2016
mllib-local bump to 2.2.0-k8s-0.4.0-SNAPSHOT Aug 10, 2017
mllib bump to 2.2.0-k8s-0.4.0-SNAPSHOT Aug 10, 2017
project Dynamic allocation (#272) Jul 24, 2017
python Preparing Spark release v2.2.0-rc6 Jun 30, 2017
repl bump to 2.2.0-k8s-0.4.0-SNAPSHOT Aug 10, 2017
resource-managers Fix license check (#442) Aug 18, 2017
sbin [SPARK-19083] sbin/start-history-server.sh script use of $@ without q… Jan 6, 2017
sql bump to 2.2.0-k8s-0.4.0-SNAPSHOT Aug 10, 2017
streaming bump to 2.2.0-k8s-0.4.0-SNAPSHOT Aug 10, 2017
tools bump to 2.2.0-k8s-0.4.0-SNAPSHOT Aug 10, 2017
.gitattributes [SPARK-3870] EOL character enforcement Oct 31, 2014
.gitignore [SPARK-19562][BUILD] Added exclude for dev/pr-deps to gitignore Feb 13, 2017
.travis.yml Exclude flaky ExternalShuffleServiceSuite from Travis (#185) Jul 24, 2017
CONTRIBUTING.md [SPARK-18073][DOCS][WIP] Migrate wiki to spark.apache.org web site Nov 23, 2016
LICENSE [SPARK-20759] SCALA_VERSION in _config.yml should be consistent with … May 19, 2017
NOTICE [SPARK-18262][BUILD][SQL] JSON.org license is now CatX Nov 10, 2016
README.md Link to architecture docs (#432) Aug 14, 2017
appveyor.yml [MINOR][R] Add knitr and rmarkdown packages/improve output for versio… Jun 18, 2017
pom.xml Removed deprecated option from pom (#433) Aug 14, 2017
scalastyle-config.xml [SPARK-13747][CORE] Add ThreadUtils.awaitReady and disallow Await.ready May 18, 2017


Apache Spark On Kubernetes

This repository, located at https://github.com/apache-spark-on-k8s/spark, contains a fork of Apache Spark that enables running Spark jobs natively on a Kubernetes cluster.

What is this?

This is a collaboratively maintained project working on SPARK-18278. The goal is to bring native support for Spark to use Kubernetes as a cluster manager, in a fully supported way on par with the Spark Standalone, Mesos, and Apache YARN cluster managers.

Getting Started

Why does this fork exist?

Adding native integration for a new cluster manager is a large undertaking. If poorly executed, it could introduce bugs into Spark when run on other cluster managers, cause release blockers slowing down the overall Spark project, or require hotfixes which divert attention away from development towards managing additional releases. Any work this deep inside Spark needs to be done carefully to minimize the risk of those negative externalities.

At the same time, an increasing number of people from various companies and organizations desire to work together to natively run Spark on Kubernetes. The group needs a code repository, communication forum, issue tracking, and continuous integration, all in order to work together effectively on an open source product.

We've been asked by an Apache Spark Committer to work outside of the Apache infrastructure for a short period of time to allow this feature to be hardened and improved without creating risk for Apache Spark. The aim is to rapidly bring it to the point where it can be brought into the mainline Apache Spark repository for continued development within the Apache umbrella. If all goes well, this should be a short-lived fork rather than a long-lived one.

Who are we?

This is a collaborative effort by several folks from different companies who are interested in seeing this feature be successful. Companies active in this project include (alphabetically):

  • Bloomberg
  • Google
  • Haiwen
  • Hyperpilot
  • Intel
  • Palantir
  • Pepperdata
  • Red Hat

(original README below)

Apache Spark

Spark is a fast and general cluster computing system for Big Data. It provides high-level APIs in Scala, Java, Python, and R, and an optimized engine that supports general computation graphs for data analysis. It also supports a rich set of higher-level tools including Spark SQL for SQL and DataFrames, MLlib for machine learning, GraphX for graph processing, and Spark Streaming for stream processing.


Online Documentation

You can find the latest Spark documentation, including a programming guide, on the project web page. This README file only contains basic setup instructions.

Building Spark

Spark is built using Apache Maven. To build Spark and its example programs, run:

build/mvn -DskipTests clean package

(You do not need to do this if you downloaded a pre-built package.)

You can build Spark using more than one thread by using the -T option with Maven, see "Parallel builds in Maven 3". More detailed documentation is available from the project site, at "Building Spark".

For general development tips, including info on developing Spark using an IDE, see "Useful Developer Tools".

Interactive Scala Shell

The easiest way to start using Spark is through the Scala shell:


Try the following command, which should return 1000:

scala> sc.parallelize(1 to 1000).count()

Interactive Python Shell

Alternatively, if you prefer Python, you can use the Python shell:


And run the following command, which should also return 1000:

>>> sc.parallelize(range(1000)).count()

Example Programs

Spark also comes with several sample programs in the examples directory. To run one of them, use ./bin/run-example <class> [params]. For example:

./bin/run-example SparkPi

will run the Pi example locally.

You can set the MASTER environment variable when running examples to submit examples to a cluster. This can be a mesos:// or spark:// URL, "yarn" to run on YARN, and "local" to run locally with one thread, or "local[N]" to run locally with N threads. You can also use an abbreviated class name if the class is in the examples package. For instance:

MASTER=spark://host:7077 ./bin/run-example SparkPi

Many of the example programs print usage help if no params are given.

Running Tests

Testing first requires building Spark. Once Spark is built, tests can be run using:


Please see the guidance on how to run tests for a module, or individual tests.

A Note About Hadoop Versions

Spark uses the Hadoop core library to talk to HDFS and other Hadoop-supported storage systems. Because the protocols have changed in different versions of Hadoop, you must build Spark against the same version that your cluster runs.

Please refer to the build documentation at "Specifying the Hadoop Version" for detailed guidance on building for a particular distribution of Hadoop, including building for particular Hive and Hive Thriftserver distributions.


Please refer to the Configuration Guide in the online documentation for an overview on how to configure Spark.


Please review the Contribution to Spark guide for information on how to get started contributing to the project.