Production Best Practices for Kubernetes batch/v1 CronJobs
Kubernetes CronJobs evaluate a standard 5-field schedule inside kube-controller-manager. Prior to Kubernetes 1.27, all schedules ran in the controller-manager’s local timezone; modern clusters support spec.timeZone with IANA identifiers, though setting UTC avoids spring-forward skipped runs and fall-back duplicate triggers.
Always pair your cron schedule with explicit concurrencyPolicy (Forbid or Replace for non-idempotent jobs), successfulJobsHistoryLimit, and failedJobsHistoryLimit so high-frequency schedules like */5 * * * * do not exhaust cluster Pod or etcd quotas.
- Parser EngineKubernetes uses standard 5-field POSIX cron (robfig/cron) plus predefined macros: @yearly, @monthly, @weekly, @daily, @hourly.
- IANA Timezone (K8s 1.27+)Set spec.timeZone: "America/New_York" or "UTC" (always prefer UTC to prevent DST skip/double-run anomalies).
- Missed-Run GuardIf startingDeadlineSeconds is omitted and more than 100 schedules are missed, the CronJob controller stops scheduling the job.
Does Kubernetes CronJob support 6-field seconds or AWS ? syntax?
No. Kubernetes strictly enforces 5-field POSIX schedules (or @daily/@hourly macros). Passing 6 fields or ? causes kube-apiserver to reject the CronJob manifest.
What happens if a Kubernetes CronJob takes longer than its schedule interval?
With the default concurrencyPolicy: Allow, overlapping Jobs spawn simultaneously. Set concurrencyPolicy: Forbid to skip the next run until the active Pod finishes, or Replace to terminate the slow Pod.