Skip to content
Apache Spark enhanced with native Kubernetes scheduler back-end
Scala Java Python HiveQL R Shell Other
Branch: branch-2.2-kub…
Clone or download
Pull request Compare This branch is 561 commits ahead, 6499 commits behind apache:master.
Type Name Latest commit message Commit time
Failed to load latest commit information.
R Preparing Spark release v2.2.0-rc6 Jun 30, 2017
assembly Updated poms to 0.5.0 for the new 2.2 release (#536) Oct 27, 2017
build [SPARK-19550][BUILD][CORE][WIP] Remove Java 7 support Feb 16, 2017
common Updated poms to 0.5.0 for the new 2.2 release (#536) Oct 27, 2017
conf Update docker images for rss and shuffle service (#553) Nov 17, 2017
core Basic Secure HDFS Support [514] (#540) Dec 12, 2017
data [SPARK-16421][EXAMPLES][ML] Improve ML Example Outputs Aug 5, 2016
dev Rename package to k8s (#497) Sep 21, 2017
docs Basic Secure HDFS Support [514] (#540) Dec 12, 2017
external Updated poms to 0.5.0 for the new 2.2 release (#536) Oct 27, 2017
launcher Updated poms to 0.5.0 for the new 2.2 release (#536) Oct 27, 2017
licenses [MINOR][BUILD] Add modernizr MIT license; specify "2014 and onwards" … Jun 4, 2016
mllib-local Updated poms to 0.5.0 for the new 2.2 release (#536) Oct 27, 2017
repl Updated poms to 0.5.0 for the new 2.2 release (#536) Oct 27, 2017
sbin SparkR Support (#507) Oct 18, 2017
sql Updated poms to 0.5.0 for the new 2.2 release (#536) Oct 27, 2017
streaming Updated poms to 0.5.0 for the new 2.2 release (#536) Oct 27, 2017
tools Updated poms to 0.5.0 for the new 2.2 release (#536) Oct 27, 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
LICENSE [SPARK-20759] SCALA_VERSION in _config.yml should be consistent with … May 19, 2017
NOTICE [SPARK-18262][BUILD][SQL] license is now CatX Nov 10, 2016 Add deprecation notice to (#631) Jun 8, 2018
appveyor.yml [MINOR][R] Add knitr and rmarkdown packages/improve output for versio… Jun 18, 2017
scalastyle-config.xml [SPARK-13747][CORE] Add ThreadUtils.awaitReady and disallow Await.ready May 18, 2017

DEPRECATED. Work on this fork is discontinued. Further development is continuing on the mainline implementation of Apache Spark:

You can run Spark on Kubernetes using Spark 2.3. Some features from this work need to be ported to mainline. If a feature is missing, please check to see if we're tracking that work, and if we are not, please file a JIRA ticket indicating the missing behavior.

All other bugs and feature requests should either be proposed through JIRA or sent to or

Apache Spark On Kubernetes

This repository, located at, 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.

You can’t perform that action at this time.