Skip to content

Commit e80bed6

Browse files
author
Ross Peoples
committed
kep2140
1 parent 6da9c34 commit e80bed6

File tree

2 files changed

+17
-0
lines changed

2 files changed

+17
-0
lines changed

content/en/docs/concepts/workloads/controllers/cron-jobs.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,21 @@ For example, the line below states that the task must be started every Friday at
9191

9292
To generate CronJob schedule expressions, you can also use web tools like [crontab.guru](https://crontab.guru/).
9393

94+
## Time zones
95+
For CronJobs with no time zone specified, the kube-controller-manager interprets schedules relative to its local time zone.
96+
97+
{{< feature-state for_k8s_version="v1.24" state="alpha" >}}
98+
99+
If you enable the `CronJobTimeZone` [feature gate](/docs/reference/command-line-tools-reference/feature-gates/),
100+
you can specify a time zone for a CronJob (if you don't enable that feature gate, or if you are using a version of
101+
Kubernetes that does not have experimental time zone support, all CronJobs in your cluster have an unspecified
102+
timezone).
103+
104+
When you have the feature enabled, you can set `spec.timeZone` to the name of a valid [time zone](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones) name. For example, setting
105+
`spec.timeZone: "Etc/UTC"` instructs Kubernetes to interpret the schedule relative to Coordinated Universal Time.
106+
107+
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.
108+
94109
## CronJob limitations {#cron-job-limitations}
95110

96111
A cron job creates a job object _about_ once per execution time of its schedule. We say "about" because there

content/en/docs/reference/command-line-tools-reference/feature-gates.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -277,6 +277,7 @@ different Kubernetes components.
277277
| `CronJobControllerV2` | `false` | Alpha | 1.20 | 1.20 |
278278
| `CronJobControllerV2` | `true` | Beta | 1.21 | 1.21 |
279279
| `CronJobControllerV2` | `true` | GA | 1.22 | - |
280+
| `CronJobTimeZone` | `false` | Alpha | 1.24 | |
280281
| `CustomPodDNS` | `false` | Alpha | 1.9 | 1.9 |
281282
| `CustomPodDNS` | `true` | Beta| 1.10 | 1.13 |
282283
| `CustomPodDNS` | `true` | GA | 1.14 | - |
@@ -748,6 +749,7 @@ Each feature gate is designed for enabling/disabling a specific feature:
748749
- `CronJobControllerV2`: Use an alternative implementation of the
749750
{{< glossary_tooltip text="CronJob" term_id="cronjob" >}} controller. Otherwise,
750751
version 1 of the same controller is selected.
752+
- `CronJobTimeZone`: Allow the use of the `timeZone` optional field in [CronJobs](/docs/concepts/workloads/controllers/cron-jobs/)
751753
- `CustomCPUCFSQuotaPeriod`: Enable nodes to change `cpuCFSQuotaPeriod` in
752754
[kubelet config](/docs/tasks/administer-cluster/kubelet-config-file/).
753755
- `CustomResourceValidationExpressions`: Enable expression language validation in CRD which will validate customer resource based on validation rules written in `x-kubernetes-validations` extension.

0 commit comments

Comments
 (0)