Kubernetes Pod Operator - handle pod preemption before container creation#68328
Merged
Conversation
jscheffl
approved these changes
Jun 10, 2026
dingo4dev
pushed a commit
to dingo4dev/airflow
that referenced
this pull request
Jun 16, 2026
…tion (apache#68328) * handle preemption before container creation * add message
75 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
We have been seeing occasional failures on KPO where a pod gets preempted and then hangs, usually until the dag hits its dagrun timeout, or just for an indeterminate amount of time, once execution continues it logs that the pod doesn't exist.
What I believe is happening is that the pod is getting preempted before any containers are created, and the pod gets assigned a failed phase, however the
container_statusesarray is empty. Looking at my logs I get a kubernetes manifest with a status likeAfter implementing this I noticed #66650 which I think probably fixes the issue the majority of the time, but my only misgiving there is that I noticed in my logs instances of the kubernetes manifest being printed after the failure with a status like
Which suggests that the pod transitioned from failed back to pending. This is from a seperate execution, and its beyond me to reproduce it to allow me to understand exactly what kubernetes is doing. But since the call to define_pod_container_state involves another API call, I'm concerned it might have already transitioned back to pending by the time it is sent to that method.
Was generative AI tooling used to co-author this PR?
{pr_number}.significant.rst, in airflow-core/newsfragments. You can add this file in a follow-up commit after the PR is created so you know the PR number.