⏳ Once upon a time, there was a poor guy who had to configure a fake meeting reminder to edit the UTC Kubernetes cronjob configuration two times in a year:
- on standard time start
- on the switch to the daylight time
All that stuff was to guarantee that a routine/sw was running at a specific local time (ex.
1.27 kubernetes version, this is finally an old nightmare since
.spec.timeZone (talking about
CronJob resource) has promoted to GA.
Kubernetes v1.27 [stable]
For CronJobs with no time zone specified, the kube-controller-manager interprets schedules relative to its local time zone.
You can specify a time zone for a CronJob by setting
.spec.timeZoneto the name of a valid time zone. For example, setting
.spec.timeZone: "Etc/UTC"instructs Kubernetes to interpret the schedule relative to Coordinated Universal Time.
A time zone database from the Go standard library is included in the binaries and used as a fallback in case an external database is not available on the system.
Unsupported TimeZone specification
Specifying a timezone using
.spec.scheduleis not officially supported (and never has been).
Starting with Kubernetes 1.29 if you try to set a schedule that includes
CRON_TZtimezone specification, Kubernetes will fail to create the resource with a validation error. Updates to CronJobs already using
CRON_TZwill continue to report a warning to the client.