Kubernetes CronJob schedule
Check the spec.schedule before it hits the cluster, preview it in the zone you’ll set in spec.timeZone, and copy a manifest with sensible defaults.
✓ Valid cron
Every 6 hours, on the hour.
Next 10 runs
Calculating in your browser…
Times are computed in your browser for the selected zone and are informational. The server that runs the job uses its own zone (often UTC) and cron flavour, so verify there.
Same schedule in other dialects
Unix crontab
0 */6 * * *Quartz
0 0 */6 * * ?Spring @Scheduled
0 0 */6 * * ?AWS EventBridge
cron(0 */6 * * ? *)Describe it in words, get the expression
Uses AI (Unix dialect). The answer is checked by the same validator before you can apply it.
CronJob manifest
Fix the expression above to generate a working snippet.
apiVersion: batch/v1
kind: CronJob
metadata:
name: report
spec:
schedule: "0 */6 * * *"
timeZone: "Europe/Berlin"
concurrencyPolicy: Forbid
startingDeadlineSeconds: 300
successfulJobsHistoryLimit: 3
failedJobsHistoryLimit: 1
jobTemplate:
spec:
template:
spec:
restartPolicy: OnFailure
containers:
- name: report
image: busybox:1.36
command: ["sh", "-c", "date; echo generating report"]Fields worth setting
| Field | Why |
|---|---|
timeZone | Makes the schedule independent of the controller’s clock. |
concurrencyPolicy | Forbid or Replace prevent overlapping runs. |
startingDeadlineSeconds | How late a missed run may still start. Without it, old misses can pile up after downtime. |
successfulJobsHistoryLimit / failedJobsHistoryLimit | How many finished Jobs to keep (defaults 3 and 1). |
suspend | Set true to pause scheduling without deleting the CronJob. |
Test a schedule immediately with kubectl create job --from=cronjob/report report-manual.
Questions
What cron format does a Kubernetes CronJob use?
Standard five-field cron in spec.schedule, plus the macros @yearly, @annually, @monthly, @weekly, @daily, @midnight and @hourly. There is no seconds field.
How do I set a time zone for a CronJob?
Set spec.timeZone to an IANA name such as "Europe/Berlin" (stable since Kubernetes 1.27). Without it, the schedule uses the time zone of the kube-controller-manager, which is usually UTC. Putting CRON_TZ= or TZ= inside spec.schedule is not supported.
What happens if a CronJob run is missed?
If the controller could not start a job on time, it starts it late as long as startingDeadlineSeconds has not passed. If more than 100 schedules are missed, the controller logs an error and stops trying to catch up for that CronJob.
How do I stop jobs overlapping?
Set concurrencyPolicy: Forbid to skip a run while the previous one is still going, or Replace to cancel the old one. The default, Allow, lets them run in parallel.