Skip to content

Commit 15a9098

Browse files
authored
Merge pull request #29455 from cndoit18/feat/add-cronjob-timezone
[en]: description of the cronjob schedule timezone
2 parents 98e115c + 4211fa7 commit 15a9098

File tree

1 file changed

+15
-12
lines changed

1 file changed

+15
-12
lines changed

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

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,15 @@ weight: 80
1010

1111
<!-- overview -->
1212

13-
{{< feature-state for_k8s_version="v1.21" state="stable" >}}
13+
{{< feature-state for_k8s_version="v1.22" state="stable" >}}
1414

1515
A _CronJob_ creates {{< glossary_tooltip term_id="job" text="Jobs" >}} on a repeating schedule.
1616

1717
One CronJob object is like one line of a _crontab_ (cron table) file. It runs a job periodically
1818
on a given schedule, written in [Cron](https://en.wikipedia.org/wiki/Cron) format.
1919

20+
In addition, the CronJob schedule supports timezone handling, you can specify the timezone by adding "CRON_TZ=<time zone>" at the beginning of the CronJob schedule, and it is recommended to always set `CRON_TZ`.
21+
2022
{{< caution >}}
2123
All **CronJob** `schedule:` times are based on the timezone of the
2224
{{< glossary_tooltip term_id="kube-controller-manager" text="kube-controller-manager" >}}.
@@ -53,15 +55,16 @@ takes you through this example in more detail).
5355
### Cron schedule syntax
5456

5557
```
56-
# ┌───────────── minute (0 - 59)
57-
# │ ┌───────────── hour (0 - 23)
58-
# │ │ ┌───────────── day of the month (1 - 31)
59-
# │ │ │ ┌───────────── month (1 - 12)
60-
# │ │ │ │ ┌───────────── day of the week (0 - 6) (Sunday to Saturday;
61-
# │ │ │ │ │ 7 is also Sunday on some systems)
62-
# │ │ │ │ │
63-
# │ │ │ │ │
64-
# * * * * *
58+
# ┌────────────────── timezone (optional)
59+
# | ┌───────────── minute (0 - 59)
60+
# | │ ┌───────────── hour (0 - 23)
61+
# | │ │ ┌───────────── day of the month (1 - 31)
62+
# | │ │ │ ┌───────────── month (1 - 12)
63+
# | │ │ │ │ ┌───────────── day of the week (0 - 6) (Sunday to Saturday;
64+
# | │ │ │ │ │ 7 is also Sunday on some systems)
65+
# | │ │ │ │ │
66+
# | │ │ │ │ │
67+
# CRON_TZ=UTC * * * * *
6568
```
6669

6770

@@ -75,9 +78,9 @@ takes you through this example in more detail).
7578

7679

7780

78-
For example, the line below states that the task must be started every Friday at midnight, as well as on the 13th of each month at midnight:
81+
For example, the line below states that the task must be started every Friday at midnight, as well as on the 13th of each month at midnight(in UTC):
7982

80-
`0 0 13 * 5`
83+
`CRON_TZ=UTC 0 0 13 * 5`
8184

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

0 commit comments

Comments
 (0)