Kubernetes CronJob Schedule
A copyable batch/v1 CronJob manifest, what spec.schedule and spec.timeZone accept, and how Kubernetes handles overlapping, late and missed runs.
How do you set a Kubernetes CronJob schedule? Put a five-field cron string in spec.schedule of a batch/v1 CronJob: minute, hour, day of month, month and day of week. 0 3 * * 1 runs every Monday at 3 AM. Macros such as @daily also work. Set spec.timeZone to a name like Etc/UTC; without it, the kube-controller-manager's local time zone applies.
apiVersion: batch/v1
kind: CronJob
metadata:
name: hello # 52 characters at most
spec:
schedule: "0 3 * * 1" # Mondays at 03:00
timeZone: "Etc/UTC" # IANA time zone name
concurrencyPolicy: Forbid # Allow (default), Forbid or Replace
startingDeadlineSeconds: 200 # skip a run more than 200 s late
successfulJobsHistoryLimit: 3 # default 3
failedJobsHistoryLimit: 1 # default 1
suspend: false # true pauses future runs
jobTemplate:
spec:
template:
spec:
containers:
- name: hello
image: busybox:1.28
imagePullPolicy: IfNotPresent
command:
- /bin/sh
- -c
- date; echo Hello from the Kubernetes cluster
restartPolicy: OnFailure0 3 * * 1At 03:00 AM, only on Monday
- …
- …
- …
- …
- …
What does each field in a CronJob schedule mean?
spec.schedule is required and takes five cron fields: minute (0 to 59), hour (0 to 23), day of the month (1 to 31), month (1 to 12) and day of the week (0 to 6, Sunday to Saturday, or sun to sat). The Kubernetes docs use 0 3 * * 1 as their example, a weekly run on Mondays at 3 AM, and the manifest above keeps it.
Vixie cron step values work too. 0-23/2 in the hour field runs every other hour, and */2 is the short form, the same idea as our cron expression for every 2 hours. A question mark means the same as an asterisk. Quote the value in YAML, as the docs' examples do, and check it in the cron expression generator before you apply it.
Which schedule macros does a Kubernetes CronJob accept?
A CronJob accepts five macros in place of the five fields. @yearly (or @annually) is 0 0 1 1 *, midnight on 1 January. @monthly is 0 0 1 * *, @weekly is 0 0 * * 0, midnight on Sunday morning, @daily (or @midnight) is 0 0 * * *, and @hourly is 0 * * * *, the start of every hour.
Macros read well in a manifest, but they do not carry over everywhere. GitHub's docs say Actions does not support @yearly, @monthly, @weekly, @daily or @hourly, so write the five fields if the same schedule also lives in a workflow. Our weekly cron expression and daily at midnight cron expression pages break those two down field by field.
How do you set the time zone for a Kubernetes CronJob?
Set spec.timeZone to a name from the tz database, such as Etc/UTC. The field has been stable since Kubernetes v1.27. If you leave it out, the kube-controller-manager reads the schedule in its own local time zone, so the run time follows that process's zone, not your own. The preview above runs the example in Etc/UTC to match the manifest.
Do not write CRON_TZ= or TZ= inside spec.schedule. The docs say this was never officially supported, and Kubernetes refuses to create or update a CronJob whose schedule contains it, with a validation error. Valid names come from the system time zone database, with a copy from the Go standard library as a fallback. If a name stops being valid later, for example after a host change, the controller stops creating Jobs and records an UnknownTimeZone event.
What happens when a CronJob run overlaps, starts late or is missed?
concurrencyPolicy covers overlaps. Allow, the default, lets a new Job start while the previous one is still running. Forbid skips the new run. Replace cancels the running Job and starts the new one. The policy only applies to Jobs from the same CronJob; Jobs from two different CronJobs can always run at the same time.
startingDeadlineSeconds sets how late a run may start. With 200, a Job can be created up to 200 seconds after its scheduled time; past that, the run is skipped and counted as failed, while later runs stay scheduled. Leave it unset and there is no deadline. Keep it at 10 seconds or more: the controller checks every 10 seconds, so a smaller value may mean the CronJob is never scheduled.
Scheduling is approximate. A CronJob creates a Job about once per scheduled time, and in some circumstances two Jobs or none, so the docs say your Jobs should be idempotent. If the controller finds more than 100 missed schedules, it records a TooManyMissedTimes warning and starts only the most recent one. With startingDeadlineSeconds set, it counts misses only inside that window, for example the last 200 seconds.
How do you pause a CronJob or limit its Job history?
Set spec.suspend to true to pause a CronJob; it defaults to false. Jobs that already started keep running, and later runs stay scheduled but do not start. Suspended runs count as missed. When you set suspend back to false on a CronJob with no starting deadline, the most recent missed run starts right away and the earlier ones never run.
successfulJobsHistoryLimit keeps 3 finished successful Jobs by default and failedJobsHistoryLimit keeps 1 failed Job; 0 keeps none. Editing a CronJob only changes Jobs that start after the edit, so a Job that is already running carries on with the old template.
Sources
Last verified 16 Nov 2026 against these pages.
Frequently asked
Why does my Kubernetes CronJob run at the wrong hour?
Without spec.timeZone, the kube-controller-manager reads spec.schedule in its own local time zone, which may not be yours. Add spec.timeZone with a tz database name such as Etc/UTC. It has been a stable field since Kubernetes v1.27.
Can I put CRON_TZ or TZ in a CronJob schedule?
No. The Kubernetes docs say CRON_TZ or TZ inside spec.schedule is not officially supported and never has been. Kubernetes refuses to create or update the CronJob and returns a validation error. Use the spec.timeZone field instead.
How do I stop a CronJob from running two Jobs at once?
Set concurrencyPolicy: Forbid. If a run is due while the previous Job is still going, the CronJob skips the new run. Replace cancels the running Job and starts a new one instead. The default, Allow, lets them overlap.
How long can a Kubernetes CronJob name be?
52 characters at most. The CronJob controller appends 11 characters to the name for each Job it creates, and a Job name cannot be longer than 63 characters. The docs also suggest following the stricter DNS label rules for the name.
How do I check that a CronJob is scheduled?
Run kubectl get cronjob followed by the CronJob's name. The output lists SCHEDULE, SUSPEND, ACTIVE and LAST SCHEDULE columns. kubectl get jobs --watch then shows each Job as the CronJob creates it.