Kubernetes operator for managing the lifecycle of Apache Spark applications on Kubernetes.
Go to file
Manabu McCloskey 851668f7ca
fix and add back unit tests (#2532)
* fix and add back unit tests

Signed-off-by: Manabu McCloskey <manabu.mccloskey@gmail.com>

* add more tests

Signed-off-by: Manabu McCloskey <manabu.mccloskey@gmail.com>

---------

Signed-off-by: Manabu McCloskey <manabu.mccloskey@gmail.com>
2025-05-17 11:05:24 +00:00
.github Remove sparkctl (#2466) 2025-04-21 06:46:26 +00:00
api/v1beta2 Add ShuffleTrackingEnabled to DynamicAllocation struct to allow disabling shuffle tracking (#2511) 2025-05-14 05:49:22 +00:00
charts/spark-operator-chart Add ShuffleTrackingEnabled to DynamicAllocation struct to allow disabling shuffle tracking (#2511) 2025-05-14 05:49:22 +00:00
cmd/operator Remove v1beta1 API (#2516) 2025-05-03 00:00:04 +00:00
config Add ShuffleTrackingEnabled to DynamicAllocation struct to allow disabling shuffle tracking (#2511) 2025-05-14 05:49:22 +00:00
docs Add ShuffleTrackingEnabled to DynamicAllocation struct to allow disabling shuffle tracking (#2511) 2025-05-14 05:49:22 +00:00
examples Adding securityContext to spark examples (#2530) 2025-05-13 02:40:20 +00:00
hack Remove clientset, informer and listers generated by code-generator (#2506) 2025-04-27 03:20:59 +00:00
internal fix and add back unit tests (#2532) 2025-05-17 11:05:24 +00:00
pkg Add ShuffleTrackingEnabled to DynamicAllocation struct to allow disabling shuffle tracking (#2511) 2025-05-14 05:49:22 +00:00
proposals docs: Add information about KEP process (#2440) 2025-02-15 00:03:37 +00:00
spark-docker Upgrade to Spark 3.5.5 (#2490) 2025-03-26 11:22:03 +00:00
test/e2e Remove v1beta1 API (#2516) 2025-05-03 00:00:04 +00:00
.dockerignore Remove sparkctl (#2466) 2025-04-21 06:46:26 +00:00
.gitignore Remove sparkctl (#2466) 2025-04-21 06:46:26 +00:00
.golangci.yaml Remove sparkctl (#2466) 2025-04-21 06:46:26 +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 APRA AMCOS to adopters (#2485) 2025-03-23 15:51:05 +00:00
CHANGELOG.md Add changelog for v2.1.1 (#2504) 2025-04-15 10:51:22 +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 Upgrade Golang to 1.24.1 and golangci-lint to 1.64.8 (#2494) 2025-03-31 04:01:30 +00:00
LICENSE Added LICENSE 2017-09-09 16:04:29 -07:00
Makefile Remove sparkctl (#2466) 2025-04-21 06:46:26 +00:00
OWNERS Promoted jacobsalway from reviewer to approver (#2361) 2024-12-15 14:55:08 +00:00
PROJECT Remove v1beta1 API (#2516) 2025-05-03 00:00:04 +00:00
README.md Remove v1beta1 API (#2516) 2025-05-03 00:00:04 +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 Bump golang.org/x/net from 0.37.0 to 0.38.0 (#2505) 2025-04-21 08:32:26 +00:00
go.sum Bump golang.org/x/net from 0.37.0 to 0.38.0 (#2505) 2025-04-21 08:32:26 +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 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.1.x v1beta2 1.16+ 3.5.3
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.