Jobs

The Job Controller and Completion Patterns

A Job creates Pods until enough succeed (completions, default 1), at most parallelism at a time; PostgreSQL StatefulSet's db-init is the simplest case. Its Pods use restartPolicy: OnFailure (the kubelet restarts the container in place) or Never (a fresh Pod per retry, the failed one kept for its logs). Failures count against backoffLimit (default 6), with retries delayed 10 s, 20 s, 40 s and so on up to six minutes; past the limit the Job fails with reason BackoffLimitExceeded. activeDeadlineSeconds caps the total run time, ttlSecondsAfterFinished deletes a finished Job and its Pods, and podFailurePolicy (stable since 1.31) fails fast on hopeless exit codes or ignores disruptions such as node drains.