@@ -54,7 +54,7 @@ recommended in a production cluster.
54
54
-->
55
55
56
56
{{< caution >}}
57
- 如 [ v1 CronJob API] ( /zh/docs/reference/kubernetes-api/workload-resources/cron-job-v1/ ) 所述,官方并不支持设置时区。
57
+ 如 [ v1 CronJob API] ( /zh-cn /docs/reference/kubernetes-api/workload-resources/cron-job-v1/ ) 所述,官方并不支持设置时区。
58
58
59
59
Kubernetes 项目官方并不支持设置如 ` CRON_TZ ` 或者 ` TZ ` 等变量。
60
60
` CRON_TZ ` 或者 ` TZ ` 是用于解析和计算下一个 Job 创建时间所使用的内部库中一个实现细节。
@@ -69,7 +69,7 @@ append 11 characters to the job name provided and there is a constraint that the
69
69
maximum length of a Job name is no more than 63 characters.
70
70
-->
71
71
为 CronJob 资源创建清单时,请确保所提供的名称是一个合法的
72
- [ DNS 子域名] ( /zh/docs/concepts/overview/working-with-objects/names#dns-subdomain-names ) .
72
+ [ DNS 子域名] ( /zh-cn /docs/concepts/overview/working-with-objects/names#dns-subdomain-names ) 。
73
73
名称不能超过 52 个字符。
74
74
这是因为 CronJob 控制器将自动在提供的 Job 名称后附加 11 个字符,并且存在一个限制,
75
75
即 Job 名称的最大长度不能超过 63 个字符。
@@ -84,8 +84,7 @@ report generation, and so on. Each of those tasks should be configured to recur
84
84
indefinitely (for example: once a day / week / month); you can define the point
85
85
in time within that interval when the job should start.
86
86
-->
87
- ## CronJob
88
-
87
+ ## CronJob {#cronjob}
89
88
90
89
CronJob 用于执行周期性的动作,例如备份、报告生成等。
91
90
这些任务中的每一个都应该配置为周期性重复的(例如:每天/每周/每月一次);
@@ -96,19 +95,19 @@ CronJob 用于执行周期性的动作,例如备份、报告生成等。
96
95
97
96
This example CronJob manifest prints the current time and a hello message every minute:
98
97
-->
99
- ### 示例
98
+ ### 示例 {#example}
100
99
101
100
下面的 CronJob 示例清单会在每分钟打印出当前时间和问候消息:
102
101
103
102
{{< codenew file="application/job/cronjob.yaml" >}}
104
103
105
- [ 使用 CronJob 运行自动化任务] ( /zh/docs/tasks/job/automated-tasks-with-cron-jobs/ )
104
+ [ 使用 CronJob 运行自动化任务] ( /zh-cn /docs/tasks/job/automated-tasks-with-cron-jobs/ )
106
105
一文会为你详细讲解此例。
107
106
108
107
<!--
109
108
### Cron schedule syntax
110
109
-->
111
- ### Cron 时间表语法
110
+ ### Cron 时间表语法 {#cron-schedule-syntax}
112
111
113
112
```
114
113
# ┌───────────── 分钟 (0 - 59)
@@ -168,17 +167,17 @@ When you have the feature enabled, you can set `spec.timeZone` to the name of a
168
167
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.
169
168
-->
170
169
171
- ## 时区 {#time-zones}
170
+ ## 时区 {#time-zones}
172
171
对于没有指定时区的 CronJob,kube-controller-manager 基于本地时区解释排期表(Schedule)。
173
172
174
173
{{< feature-state for_k8s_version="v1.24" state="alpha" >}}
175
174
176
- 如果启用了 ` CronJobTimeZone ` [ 特性门控] ( /zh/docs/reference/command-line-tools-reference/feature-gates/ ) ,
175
+ 如果启用了 ` CronJobTimeZone ` [ 特性门控] ( /zh-cn /docs/reference/command-line-tools-reference/feature-gates/ ) ,
177
176
你可以为 CronJob 指定一个时区(如果你没有启用该特性门控,或者你使用的是不支持试验性时区功能的
178
177
Kubernetes 版本,集群中所有 CronJob 的时区都是未指定的)。
179
178
180
179
启用该特性后,你可以将 ` spec.timeZone `
181
- 设置为有效[ 时区] ( https://zh.wikipedia.org/zh-hant /%E6%97%B6%E5%8C%BA%E4%BF%A1%E6%81%AF%E6%95%B0%E6%8D%AE%E5%BA%93s ) 名称。
180
+ 设置为有效[ 时区] ( https://zh.wikipedia.org/wiki /%E6%97%B6%E5%8C%BA%E4%BF%A1%E6%81%AF%E6%95%B0%E6%8D%AE%E5%BA%93 ) 名称。
182
181
例如,设置 ` spec.timeZone: "Etc/UTC" ` 指示 Kubernetes 采用 UTC 来解释排期表。
183
182
184
183
Go 标准库中的时区数据库包含在二进制文件中,并用作备用数据库,以防系统上没有可用的外部数据库。
@@ -188,7 +187,7 @@ Go 标准库中的时区数据库包含在二进制文件中,并用作备用
188
187
## Time zones
189
188
For CronJobs with no time zone specified, the kube-controller-manager interprets schedules relative to its local time zone.
190
189
-->
191
- ## 时区 {#time-zones}
190
+ ## 时区 {#time-zones}
192
191
对于没有指定时区的 CronJob,kube-controller-manager 会根据其本地时区来解释其排期表(schedule)。
193
192
194
193
{{< feature-state for_k8s_version="v1.24" state="alpha" >}}
@@ -199,7 +198,7 @@ you can specify a time zone for a CronJob (if you don't enable that feature gate
199
198
Kubernetes that does not have experimental time zone support, all CronJobs in your cluster have an unspecified
200
199
timezone).
201
200
-->
202
- 如果启用 ` CronJobTimeZone ` [ 特性门控] ( /zh/docs/reference/command-line-tools-reference/feature-gates/ ) ,
201
+ 如果启用 ` CronJobTimeZone ` [ 特性门控] ( /zh-cn /docs/reference/command-line-tools-reference/feature-gates/ ) ,
203
202
你可以为 CronJob 指定时区(如果你不启用该特性门控,或者如果你使用的 Kubernetes 版本不支持实验中的时区特性,
204
203
则集群中的所有 CronJob 都属于未指定时区)。
205
204
@@ -209,7 +208,7 @@ When you have the feature enabled, you can set `spec.timeZone` to the name of a
209
208
210
209
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.
211
210
-->
212
- 当你启用该特性时,你可以将 ` spec.timeZone ` 设置为有效的[ 时区] ( https://en .wikipedia.org/wiki/List_of_tz_database_time_zones ) 名称。
211
+ 当你启用该特性时,你可以将 ` spec.timeZone ` 设置为有效的[ 时区] ( https://zh .wikipedia.org/wiki/%E6%97%B6%E5%8C%BA%E4%BF%A1%E6%81%AF%E6%95%B0%E6%8D%AE%E5%BA%93 ) 名称。
213
212
例如,设置 ` spec.timeZone: "Etc/UTC" ` 表示 Kubernetes
214
213
使用协调世界时(Coordinated Universal Time)进行解释排期表。
215
214
@@ -221,7 +220,7 @@ A cron job creates a job object _about_ once per execution time of its schedule.
221
220
are certain circumstances where two jobs might be created, or no job might be created. We attempt to make these rare,
222
221
but do not completely prevent them. Therefore, jobs should be _idempotent_.
223
222
-->
224
- ## CronJob 限制 {#cron-job -limitations}
223
+ ## CronJob 限制 {#cronjob -limitations}
225
224
226
225
CronJob 根据其计划编排,在每次该执行任务的时候大约会创建一个 Job。
227
226
我们之所以说 "大约",是因为在某些情况下,可能会创建两个 Job,或者不会创建任何 Job。
@@ -306,12 +305,12 @@ and use the original CronJob controller instead, one pass the `CronJobController
306
305
flag to the {{< glossary_tooltip term_id="kube-controller-manager" text="kube-controller-manager" >}},
307
306
and set this flag to `false`. For example:
308
307
-->
309
- ## 控制器版本 {#new-controller}
308
+ ## 控制器版本 {#new-controller}
310
309
311
310
从 Kubernetes v1.21 版本开始,CronJob 控制器的第二个版本被用作默认实现。
312
311
要禁用此默认 CronJob 控制器而使用原来的 CronJob 控制器,请在
313
312
{{< glossary_tooltip term_id="kube-controller-manager" text="kube-controller-manager" >}}
314
- 中设置[ 特性门控] ( /zh/docs/reference/command-line-tools-reference/feature-gates/ )
313
+ 中设置[ 特性门控] ( /zh-cn /docs/reference/command-line-tools-reference/feature-gates/ )
315
314
` CronJobControllerV2 ` ,将此标志设置为 ` false ` 。例如:
316
315
317
316
```
@@ -335,11 +334,11 @@ and set this flag to `false`. For example:
335
334
object definition to understand the API for Kubernetes cron jobs.
336
335
-->
337
336
338
- * 了解 CronJob 所依赖的 [ Pods ] ( /zh/docs/concepts/workloads/pods/ ) 与 [ Job] ( /zh/docs/concepts/workloads/controllers/job/ ) 的概念。
337
+ * 了解 CronJob 所依赖的 [ Pod ] ( /zh-cn /docs/concepts/workloads/pods/ ) 与 [ Job] ( /zh-cn /docs/concepts/workloads/controllers/job/ ) 的概念。
339
338
* 阅读 CronJob ` .spec.schedule ` 字段的[ 格式] ( https://pkg.go.dev/github.com/robfig/cron/v3#hdr-CRON_Expression_Format ) 。
340
339
* 有关创建和使用 CronJob 的说明及示例规约文件,请参见
341
- [ 使用 CronJob 运行自动化任务] ( /zh/docs/tasks/job/automated-tasks-with-cron-jobs/ ) 。
342
- * 有关自动清理失败或完成作业的说明,请参阅[ 自动清理作业] ( /zh/docs/concepts/workloads/controllers/job/#clean-up-finished-jobs-automatically )
340
+ [ 使用 CronJob 运行自动化任务] ( /zh-cn /docs/tasks/job/automated-tasks-with-cron-jobs/ ) 。
341
+ * 有关自动清理失败或完成作业的说明,请参阅[ 自动清理作业] ( /zh-cn /docs/concepts/workloads/controllers/job/#clean-up-finished-jobs-automatically )
343
342
* ` CronJob ` 是 Kubernetes REST API 的一部分,
344
343
阅读 {{< api-reference page="workload-resources/cron-job-v1" >}}
345
344
对象定义以了解关于该资源的 API。
0 commit comments