Skip to content

Commit 861c091

Browse files
committed
[zh-cn] sync job replicaset downward-api
Signed-off-by: xin.li <xin.li@daocloud.io>
1 parent 2c5c1db commit 861c091

File tree

3 files changed

+48
-52
lines changed

3 files changed

+48
-52
lines changed

content/zh-cn/docs/concepts/workloads/controllers/job.md

Lines changed: 23 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -598,28 +598,39 @@ Pod 考虑在内,评估相关 Job 的 `.backoffLimit` 和 `.podFailurePolicy`
598598
There are situations where you want to fail a Job after some amount of retries
599599
due to a logical error in configuration etc.
600600
To do so, set `.spec.backoffLimit` to specify the number of retries before
601-
considering a Job as failed. The back-off limit is set by default to 6. Failed
602-
Pods associated with the Job are recreated by the Job controller with an
603-
exponential back-off delay (10s, 20s, 40s ...) capped at six minutes.
604-
605-
The number of retries is calculated in two ways:
601+
considering a Job as failed.
606602
607-
- The number of Pods with `.status.phase = "Failed"`.
608-
- When using `restartPolicy = "OnFailure"`, the number of retries in all the
609-
containers of Pods with `.status.phase` equal to `Pending` or `Running`.
603+
The `.spec.backoffLimit` is set by default to 6, unless the
604+
[backoff limit per index](#backoff-limit-per-index) (only Indexed Job) is specified.
605+
When `.spec.backoffLimitPerIndex` is specified, then `.spec.backoffLimit` defaults
606+
to 2147483647 (MaxInt32).
610607
611-
If either of the calculations reaches the `.spec.backoffLimit`, the Job is
612-
considered failed.
608+
Failed Pods associated with the Job are recreated by the Job controller with an
609+
exponential back-off delay (10s, 20s, 40s ...) capped at six minutes.
613610
-->
614611
### Pod 回退失效策略 {#pod-backoff-failure-policy}
615612

616613
在有些情形下,你可能希望 Job 在经历若干次重试之后直接进入失败状态,
617614
因为这很可能意味着遇到了配置错误。
618615
为了实现这点,可以将 `.spec.backoffLimit` 设置为视 Job 为失败之前的重试次数。
619-
失效回退的限制值默认为 6。
616+
`.spec.backoffLimit` 的值默认为 6,
617+
除非指定了[每个索引的退避限制](#backoff-limit-per-index)(仅限带索引的 Job)。
618+
当指定 `.spec.backoffLimitPerIndex` 时,`.spec.backoffLimit`
619+
默认为 2147483647 (MaxInt32)。
620+
620621
与 Job 相关的失效的 Pod 会被 Job 控制器重建,回退重试时间将会按指数增长
621622
(从 10 秒、20 秒到 40 秒)最多至 6 分钟。
622623

624+
<!--
625+
The number of retries is calculated in two ways:
626+
627+
- The number of Pods with `.status.phase = "Failed"`.
628+
- When using `restartPolicy = "OnFailure"`, the number of retries in all the
629+
containers of Pods with `.status.phase` equal to `Pending` or `Running`.
630+
631+
If either of the calculations reaches the `.spec.backoffLimit`, the Job is
632+
considered failed.
633+
-->
623634
计算重试次数有以下两种方法:
624635
- 计算 `.status.phase = "Failed"` 的 Pod 数量。
625636
- 当 Pod 的 `restartPolicy = "OnFailure"` 时,针对 `.status.phase` 等于 `Pending`
@@ -647,18 +658,7 @@ from failed Jobs is not lost inadvertently.
647658
-->
648659
### 逐索引的回退限制 {#backoff-limit-per-index}
649660

650-
{{< feature-state for_k8s_version="v1.29" state="beta" >}}
651-
652-
{{< note >}}
653-
<!--
654-
You can only configure the backoff limit per index for an [Indexed](#completion-mode) Job, if you
655-
have the `JobBackoffLimitPerIndex` [feature gate](/docs/reference/command-line-tools-reference/feature-gates/)
656-
enabled in your cluster.
657-
-->
658-
只有在集群中启用了 `JobBackoffLimitPerIndex`
659-
[特性门控](/zh-cn/docs/reference/command-line-tools-reference/feature-gates/)
660-
才能为 [Indexed](#completion-mode) Job 配置逐索引的回退限制。
661-
{{< /note >}}
661+
{{< feature-state feature_gate_name="JobBackoffLimitPerIndex" >}}
662662

663663
<!--
664664
When you run an [indexed](#completion-mode) Job, you can choose to handle retries
@@ -964,19 +964,6 @@ For more details, see [Job termination and cleanup](#job-termination-and-cleanup
964964
-->
965965
## 成功策略 {#success-policy}
966966

967-
{{< feature-state feature_gate_name="JobSuccessPolicy" >}}
968-
969-
{{< note >}}
970-
<!--
971-
You can only configure a success policy for an Indexed Job if you have the
972-
`JobSuccessPolicy` [feature gate](/docs/reference/command-line-tools-reference/feature-gates/)
973-
enabled in your cluster.
974-
-->
975-
只有你在集群中启用了 `JobSuccessPolicy`
976-
[特性门控](/zh-cn/docs/reference/command-line-tools-reference/feature-gates/)时,
977-
才可以为带索引的 Job 配置成功策略。
978-
{{< /note >}}
979-
980967
<!--
981968
When creating an Indexed Job, you can define when a Job can be declared as succeeded using a `.spec.successPolicy`,
982969
based on the pods that succeeded.

content/zh-cn/docs/concepts/workloads/controllers/replicaset.md

Lines changed: 6 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,6 @@ title: ReplicaSet
33
api_metadata:
44
- apiVersion: "apps/v1"
55
kind: "ReplicaSet"
6-
feature:
7-
title: 自我修复
8-
anchor: ReplicationController 如何工作
9-
description: >
10-
重新启动失败的容器,在节点死亡时替换并重新调度容器,
11-
杀死不响应用户定义的健康检查的容器,
12-
并且在它们准备好服务之前不会将它们公布给客户端。
136
content_type: concept
147
description: >-
158
ReplicaSet 的作用是维持在任何给定时间运行的一组稳定的副本 Pod。
@@ -18,6 +11,12 @@ weight: 20
1811
hide_summary: true # 在章节索引中单独列出
1912
---
2013
<!--
14+
# NOTE TO LOCALIZATION TEAMS
15+
#
16+
# If updating front matter for your localization because there is still
17+
# a "feature" key in this page, then you also need to update
18+
# content/??/docs/concepts/architecture/self-healing.md (which is where
19+
# it moved to)
2120
reviewers:
2221
- Kashomon
2322
- bprashanth
@@ -26,13 +25,6 @@ title: ReplicaSet
2625
api_metadata:
2726
- apiVersion: "apps/v1"
2827
kind: "ReplicaSet"
29-
feature:
30-
title: Self-healing
31-
anchor: How a ReplicaSet works
32-
description: >
33-
Restarts containers that fail, replaces and reschedules containers when nodes die,
34-
kills containers that don't respond to your user-defined health check,
35-
and doesn't advertise them to clients until they are ready to serve.
3628
content_type: concept
3729
description: >-
3830
A ReplicaSet's purpose is to maintain a stable set of replica Pods running at any given time.
@@ -47,7 +39,6 @@ hide_summary: true # Listed separately in section index
4739
A ReplicaSet's purpose is to maintain a stable set of replica Pods running at any given time. As such, it is often
4840
used to guarantee the availability of a specified number of identical Pods.
4941
-->
50-
5142
ReplicaSet 的目的是维护一组在任何时候都处于运行状态的 Pod 副本的稳定集合。
5243
因此,它通常用来保证给定数量的、完全相同的 Pod 的可用性。
5344

content/zh-cn/docs/concepts/workloads/pods/downward-api.md

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -202,6 +202,25 @@ for resources such as CPU and memory.
202202
-->
203203
### 可通过 `resourceFieldRef` 获得的信息 {#downwardapi-resourceFieldRef}
204204

205+
这些容器级别的字段允许你提供关于
206+
[请求和限制](/zh-cn/docs/concepts/configuration/manage-resources-containers/#requests-and-limits)
207+
的资源(如 CPU 和内存)信息。
208+
209+
{{< note >}}
210+
{{< feature-state feature_gate_name="InPlacePodVerticalScaling" >}}
211+
<!--
212+
Container CPU and memory resources can be resized while the container is running.
213+
If this happens, a downward API volume will be updated,
214+
but environment variables will not be updated unless the container restarts.
215+
See [Resize CPU and Memory Resources assigned to Containers](/docs/tasks/configure-pod-container/resize-container-resources/)
216+
for more details.
217+
-->
218+
容器的 CPU 和内存资源可以在容器运行时调整大小。
219+
如果发生这种情况,Downward API 卷将会被更新,
220+
但是环境变量不会被更新,除非容器重启。
221+
更多详情请参见[调整分配给容器的 CPU 和内存资源](/zh-cn/docs/tasks/configure-pod-container/resize-container-resources/)
222+
{{< /note >}}
223+
205224
<!--
206225
`resource: limits.cpu`
207226
: A container's CPU limit
@@ -273,7 +292,6 @@ calculation.
273292
[节点可分配资源](/zh-cn/docs/tasks/administer-cluster/reserve-compute-resources/#node-allocatable)
274293
计算并暴露 CPU 和内存的最大可分配值。
275294

276-
277295
## {{% heading "whatsnext" %}}
278296

279297
<!--

0 commit comments

Comments
 (0)