feat(kubernetes): retry Job Pods lost to infrastructure disruptions - #358
Open
yuechao-qin wants to merge 1 commit into
Open
yuechao-qin wants to merge 1 commit into
yuechao-qin wants to merge 1 commit into
Conversation
Add a Pod failure policy with a single Ignore rule on the DisruptionTarget condition. Pods the cluster takes away -- preemption, eviction, taint-based deletion, node loss, graceful node shutdown -- are no longer charged to the per-index budget, so the Job controller creates a replacement Pod. Exit codes are never read, so a failing task is still failed on its first attempt: backoff_limit_per_index stays 0. https://kubernetes.io/docs/tasks/job/pod-failure-policy/
Ark-kun
approved these changes
Sep 18, 2026
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.
One
Ignorerule on theDisruptionTargetPod condition. Kubernetes creates a replacement Podwhen the cluster takes a Pod away. Nothing else changes.
This is the upstream documentation's own worked example, verbatim
(Handling retriable and non-retriable Pod failures), on top of the
backoff_limit_per_index=0the launcher already sets. 3 functional lines in
cloud_pipelines_backend/launchers/kubernetes_launchers.py.What changes
FAILEDNoExecutetaint, nodeNotReadyWhat does not change
mainexits non-zeroOOMKilled)Pending— no Pod failure, no policy involvedSYSTEM_ERROR)No exit code is ever read, so a failing task is never rerun.
Why this works
Ignore: use to indicate that the counter towards the.spec.backoffLimitshould not be incremented and a replacement Pod should be created."Ignoreaction for failed Pods with conditionDisruptionTargetexcludes Pod disruptions from being counted towards the.spec.backoffLimitlimit of retries"DisruptionTargetis set only for disruptions initiated by the cluster — preemption, eviction, taint-based deletion, node loss, graceful node shutdownpodReplacementPolicyis not set: with a Pod failure policy present the API server defaults it toFailedand permits no other valuerestartPolicy: Never— already the caseStable since Kubernetes 1.31; the feature gate has been removed.
Verification
Upstream's own procedure, against a canary Job:
The replacement Pod carries
batch.kubernetes.io/job-index-ignored-failure-count, which alreadyappears in
GET /api/executions/{id}/container_state— no new instrumentation needed.