Kubernetes Executor Commands

Note

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

GROUP_OR_COMMAND

Possible choices: kubernetes

Sub-commands

kubernetes

Tools to help run the KubernetesExecutor

airflow kubernetes [-h] COMMAND ...

Positional Arguments

COMMAND

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

Sub-commands

cleanup-pods

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
--min-pending-minutes

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

--namespace

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

Default: “default”

-v, --verbose

Make logging output more verbose

Default: False

generate-dag-yaml

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
dag_id

The id of the dag

execution_date

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?