airflow.providers.cncf.kubernetes.operators.pod_exec¶
Execute commands in existing Kubernetes pods.
Classes¶
Execute a command in a running container of an existing Kubernetes pod. |
Module Contents¶
- class airflow.providers.cncf.kubernetes.operators.pod_exec.KubernetesPodExecOperator(*, pod_name, command, namespace=None, container_name=None, kubernetes_conn_id=KubernetesHook.default_conn_name, in_cluster=None, cluster_context=None, config_file=None, do_xcom_push=False, max_xcom_output_size=_DEFAULT_MAX_XCOM_OUTPUT_SIZE, **kwargs)[source]¶
Bases:
airflow.sdk.BaseOperatorExecute a command in a running container of an existing Kubernetes pod.
The operator does not create, restart, or delete the target pod. Commands are executed directly, without a shell; include a shell explicitly in
commandwhen shell features are required.- Parameters:
pod_name (str) – Name of the existing Kubernetes pod. (templated)
command (collections.abc.Sequence[str]) – Command and arguments to execute in the container. (templated)
namespace (str | None) – Namespace containing the pod. Defaults to the namespace configured in the Kubernetes connection, then
default. (templated)container_name (str | None) – Name of the container in which to execute the command. When omitted, the
kubectl.kubernetes.io/default-containerannotation or the first container is used. (templated)kubernetes_conn_id (str | None) – The Kubernetes connection to use. (templated)
in_cluster (bool | None) – Use in-cluster Kubernetes configuration.
cluster_context (str | None) – Context to use from the kubeconfig. (templated)
config_file (str | None) – Path to the kubeconfig file. (templated)
do_xcom_push (bool) – Return standard output through XCom when
True. Defaults toFalse.max_xcom_output_size (int) – Maximum UTF-8 byte size retained for XCom. Defaults to 49,344 bytes.
- template_fields: collections.abc.Sequence[str] = ('pod_name', 'command', 'namespace', 'container_name', 'kubernetes_conn_id', 'cluster_context',...[source]¶