PySparkOnK8s
An Airflow provider that runs @task.pyspark tasks as client-mode Spark drivers on Kubernetes. The Airflow worker pod that executes the task becomes the Spark driver, and Spark creates the executors as pods. When the task ends, the executors are deleted, so every task gets its own short-lived Spark cluster.
It supports Airflow 2.11 and 3.3 with the KubernetesExecutor, Spark 4 and Python 3.10 to 3.14.
Quick start
Give the worker service account the permissions of a Spark driver:
helm install pysparkonk8s-rbac oci://ghcr.io/sdaberdaku/charts/pysparkonk8s-rbac \
--version 1.0.0 -n airflow --set serviceAccountName=<worker service account>
Use ghcr.io/sdaberdaku/pysparkonk8s/driver:1.0.0-airflow3.3.2-python3.12 as the Airflow worker image (it contains Java, PySpark and this package), then write a task:
from airflow.sdk import task # airflow.decorators on Airflow 2
from pysparkonk8s import SparkDriverConf, SparkExecutorConf, pyspark_on_k8s
driver_conf = SparkDriverConf(image="ghcr.io/sdaberdaku/pysparkonk8s/driver:1.0.0-airflow3.3.2-python3.12")
executor_conf = SparkExecutorConf(image="ghcr.io/sdaberdaku/spark:4.2.0-python3.12")
@task.pyspark
def count(spark=None):
return spark.range(1000).count()
count.override(**pyspark_on_k8s(driver_conf=driver_conf, executor_conf=executor_conf))()
To install the package in your own image, run pip install airflow-provider-pysparkonk8s. The image also needs a JRE, pyspark==4.2.0 and pyspark-client==4.2.0 (install both at the same version).
Documentation
The full documentation is at https://sdaberdaku.github.io/pysparkonk8s/: configuration reference, examples, how it works, operations and limitations.
License
Apache-2.0.
Metadata
Release files for airflow-provider-pysparkonk8s 1.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| airflow_provider_pysparkonk8s-1.0.0.tar.gz | 21.4 kB | With provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| airflow_provider_pysparkonk8s-1.0.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 40.1 kB
Release files / airflow_provider_pysparkonk8s-1.0.0.tar.gz
| Download URL | airflow_provider_pysparkonk8s-1.0.0.tar.gz |
|---|---|
| Size | 21.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
e5995a2f6026f79e570278b862e19d2552504571dcdd781fc1cbc2d1b5c7cf52
|
|
BLAKE2b-256 checksum How to use checksums |
499a2bc688ce120d902087b7040844c416665d930eb4e632d3e2204c3801a69a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 27, 2026.
Transparency logRelease files / airflow_provider_pysparkonk8s-1.0.0-py3-none-any.whl
| Download URL | airflow_provider_pysparkonk8s-1.0.0-py3-none-any.whl |
|---|---|
| Size | 18.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
7d8a2380dec4445426e39654f2c3d18482be9894528c2f6063c4ee5b5a15114e
|
|
BLAKE2b-256 checksum How to use checksums |
473bd61f88f375dc5959e63637c577030b714cbe0c4988881d78356d7814be1f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 27, 2026.
Transparency logSecurity for airflow-provider-pysparkonk8s 1.0.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
All 2 files in this release have been uploaded with provenance metadata.
Attestation for airflow_provider_pysparkonk8s-1.0.0.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 27, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.