Jump to content

Kubernetes Operator for Apache Spark

From Open Lakehouse Wiki
Apache Spark Kubernetes Operator
Developer Apache Software Foundation (Apache Spark subproject)
Initial release 0.1.0 (May 2025)
Latest release 1.1.0
(2026-11-12)
Written in Java
Type Kubernetes operator for Spark applications and clusters
License Apache License 2.0
Website Operator documentation
Repository github.com/apache/spark-kubernetes-operator
Related Spark on Kubernetes, spark-submit, Spark standalone cluster manager
Last verified 23 November 2026 against the 1.1.0 tag of apache/spark-kubernetes-operator (README, docs/architecture.md, docs/spark_custom_resources.md, docs/operations.md, docs/migration_guide.md, SparkAppSubmissionWorker.java), its GitHub releases, SPARK-45923, docs/running-on-kubernetes.md at Spark v4.3.0, the kubeflow/spark-operator README and v2.6.0 release, and the Kubeflow announcement of April 2024.

The Kubernetes Operator for Apache Spark is software that runs Spark workloads on Kubernetes through the operator pattern: users describe a Spark application or cluster as a Kubernetes custom resource, and a controller creates and watches the driver, executor and other pods until the workload ends. The name covers two projects. The Apache Spark Kubernetes Operator is an official subproject of Apache Spark with the custom resources SparkApplication and SparkCluster.[1][2] The older Kubeflow Spark Operator, which began as Google Cloud Platform's Spark on Kubernetes Operator, moved to the Kubeflow community in 2024.[3]

What does the Apache Spark Kubernetes Operator do?

The Apache Spark Kubernetes Operator acts as a control plane for the deployment lifecycle of Spark applications and clusters. It is installed with Helm, usually in its own namespace, and watches Spark custom resources in one or more workload namespaces.[4] It is built with the Java Operator SDK and talks to the Kubernetes API server with the fabric8 client.[4]

For a SparkApplication, the operator launches the driver, observes it and the executors it spawns, records their status until the application ends, and then releases the resources the application owned.[4] It builds the driver with Spark's own Kubernetes driver builder in-process, instead of starting a separate spark-submit process.[5] The Spark documentation describes the operator and spark-submit as complementary, because both use the same native Kubernetes scheduler backend; see Spark on Kubernetes.[2]

For a SparkCluster, the operator deploys a Spark standalone master and workers as StatefulSets exposed through Kubernetes services, and garbage-collects them when the resource is deleted.[6]

What does a SparkApplication look like?

A SparkApplication in API group spark.apache.org/v1 names the entry point (mainClass and jars for JVM applications, pyFiles for Python), the Spark configuration in sparkConf, and the Spark version in runtimeVersions.[6] This example, adapted from the operator's Python example, runs the PySpark Pi program:[7]

apiVersion: spark.apache.org/v1
kind: SparkApplication
metadata:
  name: pi-python
spec:
  pyFiles: "local:///opt/spark/examples/src/main/python/pi.py"
  sparkConf:
    spark.kubernetes.authenticate.driver.serviceAccountName: "spark"
    spark.kubernetes.container.image: "apache/spark:4.3.0-python3"
  runtimeVersions:
    sparkVersion: "4.3.0"

kubectl get sparkapp lists applications with their current state. Pod details that Spark configuration cannot set go in spec.driverSpec.podTemplateSpec and spec.executorSpec.podTemplateSpec, which take precedence over spark.kubernetes.[driver|executor].podTemplateFile.[1][6]

What is the SparkApplication lifecycle?

The operator moves each SparkApplication through a state machine. A typical successful run goes Submitted, DriverRequested, DriverStarted, DriverReady, RunningHealthy, Succeeded and finally ResourceReleased.[4] While running, an application can also be in RunningWithBelowThresholdExecutors or RunningWithPartialCapacity when fewer executors are available than requested.[4]

The failure states are SchedulingFailure, DriverStartTimedOut, DriverReadyTimedOut, ExecutorsStartTimedOut, DriverEvicted and Failed. From a failure the application moves to ScheduledToRestart if a retry is configured, or to ResourceReleased; a retain policy can hold it in TerminatedWithoutReleaseResources first.[4] The operator treats DriverStartTimedOut, ExecutorsStartTimedOut and SchedulingFailure as likely infrastructure failures on a best-effort basis, and restartConfig.restartPolicy accepts Never, Always, OnFailure and OnInfrastructureFailure.[6]

Since 1.1.0, both custom resources have spec.suspend and a Suspended state, and the operator can queue workloads through Kueue when spark.kubernetes.operator.kueue.enabled is set.[8][4]

Which versions does it support?

The 1.1.0 release, published on 12 November 2026, supports Kubernetes 1.35 to 1.37 and Apache Spark 4.0 to 4.3, is built with Spark 4.3.0, and deprecates the v1beta1 custom resource definitions.[9] The migration guide says spark.apache.org/v1beta1 is scheduled for removal in 2.0.0 and that spark.apache.org/v1 should be used.[8] The operations guide lists Java 21 or newer and Spark 4.0 or above as requirements.[10]

History

The Apache Spark Kubernetes Operator was proposed in SPARK-45923, opened in November 2023, and the ticket was resolved with the operator's 0.1.0 release.[11] Release v0.1.0 was published on GitHub on 8 May 2025 and 1.0.0 on 26 July 2026.[12]

The Kubeflow Spark Operator began at Google Cloud. In April 2024 the Kubeflow project announced that Google's Spark Operator had moved to Kubeflow, under the repository kubeflow/spark-operator, to be governed by an open community.[3]

Apache Spark Kubernetes Operator vs Kubeflow Spark Operator

Apache Spark Kubernetes Operator Kubeflow Spark Operator
Home Apache Spark subproject[1] Kubeflow community; formerly Google Cloud Platform's Spark on Kubernetes Operator[3]
API group spark.apache.org/v1 (v1beta1 deprecated)[8] sparkoperator.k8s.io (v1beta2, v1alpha1)[13]
Custom resources SparkApplication, SparkCluster[6] SparkApplication, ScheduledSparkApplication, SparkConnect[13]
How the driver is created In-process with Spark's Kubernetes driver builder, no spark-submit process[5] Runs spark-submit on behalf of the user; v2.6.0 adds a REST-based submitter as an option[14][15]
Spark versions 4.0 to 4.3 (1.1.0)[9] 2.3 and up[14]
Scheduled (cron) runs No dedicated resource; the examples use a Kubernetes CronJob[16] ScheduledSparkApplication with cron schedules[14]
Standalone clusters Yes, SparkCluster[6] No standalone cluster resource[13]
Pod customization Pod template specs in the resource[6] A mutating admission webhook, for example for volumes and affinity[14]
Queueing Kueue integration since 1.1.0[9] Kueue integration (referenced by the Apache operator documentation)[6]
Latest release (checked 2026-11-23) 1.1.0, 12 November 2026[9] v2.6.0, 11 November 2026[15]
License Apache License 2.0 Apache License 2.0

Is either operator deprecated?

Neither operator is deprecated. The Apache Spark Kubernetes Operator 1.1.0 deprecates only its v1beta1 API version.[8] The Kubeflow Spark Operator v2.6.0 deprecates the client deploy mode (spec.mode: client) for SparkApplication, which still works but returns a warning.[15]

See also

References

  1. ↑ 1.0 1.1 1.2 Apache Spark K8s Operator README (tag 1.1.0). Apache Software Foundation.Retrieved 2026-11-23.
  2. ↑ 2.0 2.1 Running Spark on Kubernetes (Spark 4.3.0). Apache Software Foundation.Retrieved 2026-11-23.
  3. ↑ 3.0 3.1 3.2 Announcing the Kubeflow Spark Operator: Building a Stronger Spark on Kubernetes Community. Kubeflow, 2024-04-15.Retrieved 2026-11-23.
  4. ↑ 4.0 4.1 4.2 4.3 4.4 4.5 4.6 Design & Architecture (docs/architecture.md at 1.1.0). Apache Software Foundation.Retrieved 2026-11-23.
  5. ↑ 5.0 5.1 SparkAppSubmissionWorker.java (tag 1.1.0). Apache Software Foundation.Retrieved 2026-11-23.
  6. ↑ 6.0 6.1 6.2 6.3 6.4 6.5 6.6 6.7 Spark Operator API (docs/spark_custom_resources.md at 1.1.0). Apache Software Foundation.Retrieved 2026-11-23.
  7. ↑ examples/pi-python.yaml (tag 1.1.0). Apache Software Foundation.Retrieved 2026-11-23.
  8. ↑ 8.0 8.1 8.2 8.3 Migration Guide (docs/migration_guide.md at 1.1.0). Apache Software Foundation.Retrieved 2026-11-23.
  9. ↑ 9.0 9.1 9.2 9.3 Release 1.1.0. apache/spark-kubernetes-operator on GitHub, 2026-11-12.Retrieved 2026-11-23.
  10. ↑ Operations (docs/operations.md at 1.1.0). Apache Software Foundation.Retrieved 2026-11-23.
  11. ↑ SPARK-45923: Spark Kubernetes Operator. Apache Software Foundation JIRA.Retrieved 2026-11-23.
  12. ↑ Releases. apache/spark-kubernetes-operator on GitHub.Retrieved 2026-11-23.
  13. ↑ 13.0 13.1 13.2 config/crd/bases (tag v2.6.0). kubeflow/spark-operator on GitHub.Retrieved 2026-11-23.
  14. ↑ 14.0 14.1 14.2 14.3 Kubeflow Spark Operator README (tag v2.6.0). kubeflow/spark-operator on GitHub.Retrieved 2026-11-23.
  15. ↑ 15.0 15.1 15.2 Release v2.6.0. kubeflow/spark-operator on GitHub, 2026-11-11.Retrieved 2026-11-23.
  16. ↑ examples/job/cron-pi-swift.yaml (tag 1.1.0). Apache Software Foundation.Retrieved 2026-11-23.