Add KubernetesPodExecOperator for existing Kubernetes Pods - #71244
Add KubernetesPodExecOperator for existing Kubernetes Pods#71244AlejandroMorgante wants to merge 4 commits into
Conversation
Reusing a running Pod avoids the startup latency incurred when each task creates a new Pod.
031ffbc to
52b1cc6
Compare
What's the User story and real-world use cases for this? |
Thanks for asking. The user story is:
Our concrete use case is running dbt on EKS. Today, our workflow starts a new Pod, initializes the dbt project and its dependencies, and then executes a command such as We want to manage that Pod separately and keep it warm, then use Airflow to execute ad hoc commands such as More generally, this is useful whenever a Pod’s lifecycle is managed outside the task and its environment is already initialized. The operator exposes the equivalent of |
Add
KubernetesPodExecOperatorto execute commands in a running container of an existing Kubernetes Pod without creating, restarting, or deleting it. This supports pre-warmed and API-visible static Pods where avoiding startup latency is important.The operator validates the target Pod and container, streams stdout and stderr, supports optional stdout XCom, reports non-zero exit codes, and closes the exec connection when the task is killed. Provider metadata, RBAC guidance, and operator documentation are included.
Tests:
pytest providers/cncf/kubernetes/tests/unit/cncf/kubernetes/operators/test_pod_exec.py -q(32 passed)Was generative AI tooling used to co-author this PR?
Generated-by: Codex (GPT-5) following the guidelines