Jobs Best Practices
Batch workloads fail differently than services: they retry, accumulate, and run unattended on schedules. This list collects the practices that keep Jobs and CronJobs correct, cheap, and observable in production.
Search across all documentation pages
Batch workloads fail differently than services: they retry, accumulate, and run unattended on schedules. This list collects the practices that keep Jobs and CronJobs correct, cheap, and observable in production.
Read the groups in order when you author a new Job, and treat each bold practice as a review checkbox on pull requests.
The groups move from correctness, to reliability, to cost and cleanup, to security, to operations. Apply every item that fits your workload rather than cherry-picking.
Never for clean per-attempt Pods and logs, or OnFailure when you want fewer objects and in-place container restarts.completionMode: Indexed when Pods own fixed shards, and NonIndexed when Pods pull interchangeable work.DeadlineExceeded.FailJob on unrecoverable codes, or Ignore infrastructure disruptions so they do not consume retry budget.backoffLimitPerIndex and maxFailedIndexes so one poisoned partition does not fail the whole run.Allow stacks overlapping runs; choose Forbid for backups and reports, or Replace when only the latest run matters.successfulJobsHistoryLimit and failedJobsHistoryLimit to keep a few runs for debugging without unbounded growth.runAsNonRoot: true and a RuntimeDefault seccomp profile to align with the restricted Pod Security Standard.Failed condition and the CronJob's lastScheduleTime so a silently broken schedule surfaces quickly.You should be able to point to explicit values for backoffLimit, activeDeadlineSeconds, and ttlSecondsAfterFinished on every Job, and timeZone, concurrencyPolicy, and startingDeadlineSeconds on every CronJob.
If any of those are defaulted by omission, treat it as a gap and set them before shipping.
What is the single most forgotten field? ttlSecondsAfterFinished. Without it, finished Jobs pile up and slowly bloat the cluster.
How do I stop a Job retrying forever? Set backoffLimit and activeDeadlineSeconds. When either is exceeded, the Job is marked Failed and stops.
Why did my CronJob silently stop? It likely hit the 100-missed-schedule cliff after an outage; set startingDeadlineSeconds to prevent it.
Should batch Pods have probes? Skip readiness probes since nothing routes traffic to them, but a liveness probe or active deadline guards against hangs.
How do I keep one bad shard from failing everything? Use completionMode: Indexed with backoffLimitPerIndex and maxFailedIndexes to isolate failures.
Do batch images need the same security controls as services? Yes. Non-root, pinned bases, scanning, and signing all apply equally to Jobs.
Stack versions: This page was written for Kubernetes 1.36.2, Docker Engine 29.6.1 (BuildKit default), containerd (CRI runtime on nodes), Helm 3, Compose v2, Argo CD (latest - verify at build), and Gateway API (GA - verify controller support at build).
Reviewed by Chris St. John·Last updated Jul 16, 2026