In this article
Map trustworthy worker failure signals to an ordered Job policy and choose whether failure affects a retry, shard or entire Job.
A batch inference worker exits immediately because its input schema is incompatible. Repeating it consumes startup work without changing the cause. Job podFailurePolicy lets a workload distinguish a declared permanent error from a disruption or an ordinary retryable failure, provided the application exposes a trustworthy failure contract.
Define application signals first
Document which exit codes mean invalid configuration, transient dependency failure and successful completion. Keep that contract specific to the named worker. An exit code shared with an init helper can mean something else. Do not classify every nonzero exit as permanent simply to shorten a failing run; a policy should preserve recoverable work.
Apply ordered rules
The policy requires the Job Pod template’s restartPolicy to be Never. Rules are evaluated in order and the first match wins; unmatched failures use default handling. Restrict an exit-code rule with containerName when the meaning belongs only to the inference worker. Review overlapping conditions with explicit fixtures because a broad early rule can conceal a later intended action.
Choose the failure scope
FailJob ends the Job and triggers termination of its other active Pods. Count consumes the normal failure budget. Ignore avoids incrementing that budget while allowing replacement; it does not declare the shard successful. With the documented per-index configuration, FailIndex can isolate an unrecoverable shard. Choose scope according to whether other shards remain useful.
Observe controller evidence
Match a terminal failed Pod’s conditions and container exit state against the ordered policy. Preserve the Job’s failure-target and final conditions with the Pod identities. A deletion timestamp alone is not the complete failure classification. Avoid relying on exact replacement timing without checking the deployed controller version and replacement policy.
Exercise contrasting outcomes
Use tiny synthetic inputs that produce a permanent worker error, a retryable error and a disruption condition. Verify the selected action and completed output set, not only the number of Pods. The policy limits controller retries; it does not undo external writes, make processing exactly once or repair an incorrect application exit-code mapping.
Primary references
Handling Retriable and Non-retriable Pod Failures.
Related reading: Retrying generation POSTs: idempotency must be explicit; kubectl drain blocked by a PDB: what a disruption budget protects.
Earn rental income from GPUs
Have idle GPUs or looking to fund AI infrastructure? Retrivium finds a rental platform, sets up the server and helps you assess income and costs with a pilot.