Kubernetes operator for managing the lifecycle of Apache Spark applications on Kubernetes.
Go to file
Yi Chen 1f2cfbcae7
Add option for disabling leader election (#2423)
* Add option for disabling leader election

Signed-off-by: Yi Chen <github@chenyicn.net>

* Remove related RBAC rules when disabling leader election

Signed-off-by: Yi Chen <github@chenyicn.net>

---------

Signed-off-by: Yi Chen <github@chenyicn.net>
2025-02-10 23:15:28 +00:00
.github Add helm unittest step to integration test workflow (#2424) 2025-02-09 03:27:04 +00:00
api Support pod template for Spark 3.x applications (#2141) 2024-10-24 02:23:30 +00:00
charts/spark-operator-chart Add option for disabling leader election (#2423) 2025-02-10 23:15:28 +00:00
cmd Remove dependency on `k8s.io/kubernetes` (#2398) 2025-01-28 15:36:51 +00:00
config Support pod template for Spark 3.x applications (#2141) 2024-10-24 02:23:30 +00:00
docs Support pod template for Spark 3.x applications (#2141) 2024-10-24 02:23:30 +00:00
examples add an example of using prometheus servlet (#2403) 2025-01-27 13:50:50 +00:00
hack Add CHANGELOG.md file and use python script to generate it automatically (#2087) 2024-07-22 05:18:01 +00:00
internal Robustness to driver pod taking time to create (#2315) 2024-12-04 12:58:59 +00:00
pkg Remove dependency on `k8s.io/kubernetes` (#2398) 2025-01-28 15:36:51 +00:00
spark-docker Upgrade to Spark 3.5.3 (#2202) 2024-10-13 15:43:15 +00:00
test/e2e Fix retries (#2241) 2024-10-23 13:13:30 +00:00
.dockerignore Update the process to build api-docs, generate CRD manifests and code (#2046) 2024-07-22 05:10:00 +00:00
.gitignore Update the process to build api-docs, generate CRD manifests and code (#2046) 2024-07-22 05:10:00 +00:00
.golangci.yaml Update integration test workflow and add golangci lint check (#2197) 2024-10-08 02:06:07 +00:00
.pre-commit-config.yaml Use controller-runtime to reconsturct spark operator (#2072) 2024-08-01 12:29:06 +00:00
ADOPTERS.md Add Ninja Van to adopters (#2377) 2025-01-09 03:23:21 +00:00
CHANGELOG.md Add changelog for v2.1.0 (#2355) 2024-12-11 09:58:04 +00:00
CODE_OF_CONDUCT.md Add code of conduct and update contributor guide (#2074) 2024-06-26 18:38:10 +00:00
CONTRIBUTING.md Add code of conduct and update contributor guide (#2074) 2024-06-26 18:38:10 +00:00
Dockerfile Update default container security context (#2265) 2024-10-24 01:52:30 +00:00
LICENSE Added LICENSE 2017-09-09 16:04:29 -07:00
Makefile fix make deploy and install (#2412) 2025-02-05 11:30:37 +00:00
OWNERS Promoted jacobsalway from reviewer to approver (#2361) 2024-12-15 14:55:08 +00:00
PROJECT Use controller-runtime to reconsturct spark operator (#2072) 2024-08-01 12:29:06 +00:00
README.md Add release badge to README (#2263) 2024-10-18 11:33:20 +00:00
VERSION Add changelog for v2.1.0 (#2355) 2024-12-11 09:58:04 +00:00
entrypoint.sh Use NSS_WRAPPER_PASSWD instead of /etc/passwd as in spark-operator image entrypoint.sh (#2312) 2024-12-04 13:07:00 +00:00
go.mod Remove dependency on `k8s.io/kubernetes` (#2398) 2025-01-28 15:36:51 +00:00
go.sum Remove dependency on `k8s.io/kubernetes` (#2398) 2025-01-28 15:36:51 +00:00
version.go Use controller-runtime to reconsturct spark operator (#2072) 2024-08-01 12:29:06 +00:00

README.md

Kubeflow Spark Operator

Integration Test Go Report Card GitHub release

What is Spark Operator?

The Kubernetes Operator for Apache Spark aims to make specifying and running Spark applications as easy and idiomatic as running other workloads on Kubernetes. It uses Kubernetes custom resources for specifying, running, and surfacing status of Spark applications.

Quick Start

For a more detailed guide, please refer to the Getting Started guide.

# Add the Helm repository
helm repo add spark-operator https://kubeflow.github.io/spark-operator
helm repo update

# Install the operator into the spark-operator namespace and wait for deployments to be ready
helm install spark-operator spark-operator/spark-operator \
    --namespace spark-operator --create-namespace --wait

# Create an example application in the default namespace
kubectl apply -f https://raw.githubusercontent.com/kubeflow/spark-operator/refs/heads/master/examples/spark-pi.yaml

# Get the status of the application
kubectl get sparkapp spark-pi

Overview

For a complete reference of the custom resource definitions, please refer to the API Definition. For details on its design, please refer to the Architecture. It requires Spark 2.3 and above that supports Kubernetes as a native scheduler backend.

The Kubernetes Operator for Apache Spark currently supports the following list of features:

  • Supports Spark 2.3 and up.
  • Enables declarative application specification and management of applications through custom resources.
  • Automatically runs spark-submit on behalf of users for each SparkApplication eligible for submission.
  • Provides native cron support for running scheduled applications.
  • Supports customization of Spark pods beyond what Spark natively is able to do through the mutating admission webhook, e.g., mounting ConfigMaps and volumes, and setting pod affinity/anti-affinity.
  • Supports automatic application re-submission for updated SparkApplication objects with updated specification.
  • Supports automatic application restart with a configurable restart policy.
  • Supports automatic retries of failed submissions with optional linear back-off.
  • Supports mounting local Hadoop configuration as a Kubernetes ConfigMap automatically via sparkctl.
  • Supports automatically staging local application dependencies to Google Cloud Storage (GCS) via sparkctl.
  • Supports collecting and exporting application-level metrics and driver/executor metrics to Prometheus.

Project Status

Project status: beta

Current API version: v1beta2

If you are currently using the v1beta1 version of the APIs in your manifests, please update them to use the v1beta2 version by changing apiVersion: "sparkoperator.k8s.io/<version>" to apiVersion: "sparkoperator.k8s.io/v1beta2". You will also need to delete the previous version of the CustomResourceDefinitions named sparkapplications.sparkoperator.k8s.io and scheduledsparkapplications.sparkoperator.k8s.io, and replace them with the v1beta2 version either by installing the latest version of the operator or by running kubectl create -f config/crd/bases.

Prerequisites

  • Version >= 1.13 of Kubernetes to use the subresource support for CustomResourceDefinitions, which became beta in 1.13 and is enabled by default in 1.13 and higher.

  • Version >= 1.16 of Kubernetes to use the MutatingWebhook and ValidatingWebhook of apiVersion: admissionregistration.k8s.io/v1.

Getting Started

For getting started with Spark operator, please refer to Getting Started.

User Guide

For detailed user guide and API documentation, please refer to User Guide and API Specification.

If you are running Spark operator on Google Kubernetes Engine (GKE) and want to use Google Cloud Storage (GCS) and/or BigQuery for reading/writing data, also refer to the GCP guide.

Version Matrix

The following table lists the most recent few versions of the operator.

Operator Version API Version Kubernetes Version Base Spark Version
v2.0.x v1beta2 1.16+ 3.5.2
v1beta2-1.6.x-3.5.0 v1beta2 1.16+ 3.5.0
v1beta2-1.5.x-3.5.0 v1beta2 1.16+ 3.5.0
v1beta2-1.4.x-3.5.0 v1beta2 1.16+ 3.5.0
v1beta2-1.3.x-3.1.1 v1beta2 1.16+ 3.1.1
v1beta2-1.2.3-3.1.1 v1beta2 1.13+ 3.1.1
v1beta2-1.2.2-3.0.0 v1beta2 1.13+ 3.0.0
v1beta2-1.2.1-3.0.0 v1beta2 1.13+ 3.0.0
v1beta2-1.2.0-3.0.0 v1beta2 1.13+ 3.0.0
v1beta2-1.1.x-2.4.5 v1beta2 1.13+ 2.4.5
v1beta2-1.0.x-2.4.4 v1beta2 1.13+ 2.4.4

Developer Guide

For developing with Spark Operator, please refer to Developer Guide.

Contributor Guide

For contributing to Spark Operator, please refer to Contributor Guide.

Community

Adopters

Check out adopters of Spark Operator.