Apache Airflow CNCF Kubernetes Provider

10.15.0 · active · verified Sun Mar 29

The `apache-airflow-providers-cncf-kubernetes` package integrates Apache Airflow with Kubernetes, allowing users to orchestrate tasks by launching them as Kubernetes Pods. It provides operators and hooks for seamless interaction with Kubernetes resources. The current version, as of March 2026, is 10.15.0, and provider packages generally follow the Apache Airflow project's release cadence of roughly 2-3 months for minor versions, with patch releases as needed.

Warnings

Install

Imports

Quickstart

This quickstart demonstrates a basic Airflow DAG using the `KubernetesPodOperator` to launch a simple Ubuntu pod that executes a 'hello world' command. The pod runs in the 'default' Kubernetes namespace and is configured to be deleted upon task completion. Ensure your Airflow environment has access to a Kubernetes cluster and the necessary permissions to create pods in the specified namespace.

from __future__ import annotations

import pendulum

from airflow.models.dag import DAG
from airflow.providers.cncf.kubernetes.operators.kubernetes_pod import KubernetesPodOperator

with DAG(
    dag_id='kubernetes_pod_example',
    schedule=None,
    start_date=pendulum.datetime(2023, 1, 1, tz='UTC'),
    catchup=False,
    tags=['kubernetes', 'example'],
) as dag:
    start_pod_task = KubernetesPodOperator(
        task_id='start_pod_task',
        namespace='default',
        name='my-custom-pod',
        image='ubuntu:latest',
        cmds=['bash', '-cx'],
        arguments=['echo', 'Hello from KubernetesPodOperator!'],
        do_xcom_push=False,  # Set to True to enable XCom pushing from the pod
        is_delete_operator_pod=True, # Pod is deleted upon completion or failure
        # Optional: Specify a Kubernetes connection ID for custom client config
        # kubernetes_conn_id='my_kubernetes_connection',
        # To access Airflow variables or connections inside the Pod,
        # ensure your Airflow service account has necessary permissions.
        # E.g., for in-cluster auth, configure service account token mount.
    )

view raw JSON →