Kubernetes Executor Commands


The CLI commands below are used from provider by Airflow 2.7.0+. Previously they were part of the core Airflow, so if you are using Airflow below 2.7.0 look at the core Airflow documentation for the list of CLI commands and parameters available.

Usage: airflow [-h] GROUP_OR_COMMAND ...

Positional Arguments


Possible choices: kubernetes



Tools to help run the KubernetesExecutor

airflow kubernetes [-h] COMMAND ...

Positional Arguments


Possible choices: cleanup-pods, generate-dag-yaml



Clean up Kubernetes pods (created by KubernetesExecutor/KubernetesPodOperator) in evicted/failed/succeeded/pending states

airflow kubernetes cleanup-pods [-h]
                                [--min-pending-minutes MIN_PENDING_MINUTES]
                                [--namespace NAMESPACE] [-v]
Named Arguments

Pending pods created before the time interval are to be cleaned up, measured in minutes. Default value is 30(m). The minimum value is 5(m).

Default: 30


Kubernetes Namespace. Default value is [kubernetes] namespace in configuration.

Default: “default”

-v, --verbose

Make logging output more verbose

Default: False


Generate YAML files for all tasks in DAG. Useful for debugging tasks without launching into a cluster

airflow kubernetes generate-dag-yaml [-h] [-o OUTPUT_PATH] [-S SUBDIR] [-v]
                                     dag_id execution_date
Positional Arguments

The id of the dag


The execution date of the DAG

Named Arguments
-o, --output-path

The output for generated yaml files

Default: “[CWD]”

-S, --subdir

File location or directory from which to look for the dag. Defaults to ‘[AIRFLOW_HOME]/dags’ where [AIRFLOW_HOME] is the value you set for ‘AIRFLOW_HOME’ config you set in ‘airflow.cfg’

Default: “[AIRFLOW_HOME]/dags”

-v, --verbose

Make logging output more verbose

Default: False

Was this entry helpful?