Kubernetes CronJob

5-field cron for `CronJob` resources — same syntax as Vixie cron, plus a `timeZone` spec field since Kubernetes 1.25.

Overview

Kubernetes `CronJob` (`batch/v1`) resources use 5-field cron expressions parsed by the internal `robfig/cron/v3` parser. Syntax matches Vixie cron — step values, named days/months, and `@hourly`-style aliases are supported.

Since Kubernetes 1.25 (stable in 1.27), `spec.timeZone` lets you override the kube-controller-manager's local timezone with an IANA name (e.g. `America/New_York`). Before 1.25 the schedule was always evaluated in the controller-manager's timezone.

Field Structure

Field Order5 fields: minute hour day-of-month month day-of-week
Day-of-Week0 or 7 = Sunday, 1=Monday, …, 6=Saturday.

Special Characters

TokenMeaning
*Any value.
,List separator.
-Range.
/Step.

Aliases

  • `@yearly`, `@annually`, `@monthly`, `@weekly`, `@daily`, `@midnight`, `@hourly`.
  • `@every <duration>` (e.g. `@every 15m`) — robfig extension.

Comparison vs. Unix Cron

FeatureKubernetes CronJobUnix Cron
Field count55
Seconds fieldNo (disabled in batch/v1 parser)No
Step syntaxYesLimited
Named months/daysYesNo
AliasesYes (incl. `@every`)No
Timezone control`spec.timeZone` (1.25+)Local + `CRON_TZ`

Examples

*/5 * * * *Every 5 minutes.Try it →
0 */6 * * *Every 6 hours on the hour.Try it →
@hourlyOnce per hour.
0 0 * * 0Sundays at midnight.Try it →
0 2 1 * *02:00 on the 1st of every month.Try it →

Gotchas & Pitfalls

  • Before Kubernetes 1.25, schedules ran in the controller-manager's local timezone — not the cluster timezone or the pod timezone. Always set `spec.timeZone` on modern clusters.
  • `spec.concurrencyPolicy` (`Allow` / `Forbid` / `Replace`) determines what happens when a new run starts while the previous one is still going.
  • `spec.startingDeadlineSeconds` controls how long after the scheduled time Kubernetes will still try to launch the job. If set too short, missed schedules are skipped.
  • Schedule strings must be quoted in YAML: `schedule: "*/5 * * * *"` — without quotes the `*` characters are interpreted as YAML aliases.

References

Free cron syntax cheat sheet

© 2026 Abel Solutions LLC. All rights reserved. · More from Abel Solutions: RegexPro — test and debug regular expressions