Skip to content

Commit 5ee0781

Browse files
authored
Merge pull request #37410 from windsonsea/podlife
[zh] sync pod-lifecycle.md
2 parents f549ff6 + 9505aa7 commit 5ee0781

File tree

1 file changed

+34
-25
lines changed

1 file changed

+34
-25
lines changed

content/zh-cn/docs/concepts/workloads/pods/pod-lifecycle.md

Lines changed: 34 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ or is [terminated](#pod-termination).
4343
-->
4444
在 Kubernetes API 中,Pod 包含规约部分和实际状态部分。
4545
Pod 对象的状态包含了一组 [Pod 状况(Conditions)](#pod-conditions)
46-
如果应用需要的话,你也可以向其中注入[自定义的就绪性信息](#pod-readiness-gate)
46+
如果应用需要的话,你也可以向其中注入[自定义的就绪态信息](#pod-readiness-gate)
4747

4848
Pod 在其生命周期中只会被[调度](/zh-cn/docs/concepts/scheduling-eviction/)一次。
4949
一旦 Pod 被调度(分派)到某个节点,Pod 会一直在该节点运行,直到 Pod
@@ -58,7 +58,7 @@ Like individual application containers, Pods are considered to be relatively
5858
ephemeral (rather than durable) entities. Pods are created, assigned a unique
5959
ID ([UID](/docs/concepts/overview/working-with-objects/names/#uids)), and scheduled
6060
to nodes where they remain until termination (according to restart policy) or
61-
deletion.
61+
deletion.
6262
If a {{< glossary_tooltip term_id="node" >}} dies, the Pods scheduled to that node
6363
are [scheduled for deletion](#pod-garbage-collection) after a timeout period.
6464
-->
@@ -159,13 +159,13 @@ Value | Description
159159
`Failed`(失败) | Pod 中的所有容器都已终止,并且至少有一个容器是因为失败终止。也就是说,容器以非 0 状态退出或者被系统终止。
160160
`Unknown`(未知) | 因为某些原因无法取得 Pod 的状态。这种情况通常是因为与 Pod 所在主机通信失败。
161161

162+
{{< note >}}
162163
<!--
163164
When a Pod is being deleted, it is shown as `Terminating` by some kubectl commands.
164165
This `Terminating` status is not one of the Pod phases.
165166
A Pod is granted a term to terminate gracefully, which defaults to 30 seconds.
166167
You can use the flag `--force` to [terminate a Pod by force](/docs/concepts/workloads/pods/pod-lifecycle/#pod-termination-forced).
167168
-->
168-
{{< note >}}
169169
当一个 Pod 被删除时,执行一些 kubectl 命令会展示这个 Pod 的状态为 `Terminating`(终止)。
170170
这个 `Terminating` 状态并不是 Pod 阶段之一。
171171
Pod 被赋予一个可以体面终止的期限,默认为 30 秒。
@@ -338,7 +338,7 @@ Field name | Description
338338
字段名称 | 描述
339339
:--------------------|:-----------
340340
`type` | Pod 状况的名称
341-
`status` | 表明该状况是否适用,可能的取值有 "`True`", "`False`" 或 "`Unknown`"
341+
`status` | 表明该状况是否适用,可能的取值有 "`True`""`False`" 或 "`Unknown`"
342342
`lastProbeTime` | 上次探测 Pod 状况时的时间戳
343343
`lastTransitionTime` | Pod 上次从一种状态转换到另一种状态时的时间戳
344344
`reason` | 机器可读的、驼峰编码(UpperCamelCase)的文字,表述上次状况变化的原因
@@ -845,45 +845,53 @@ An example flow:
845845
runs that hook inside of the container. If the `preStop` hook is still running after the
846846
grace period expires, the kubelet requests a small, one-off grace period extension of 2
847847
seconds.
848-
If the `preStop` hook needs longer to complete than the default grace period allows,
849-
you must modify `terminationGracePeriodSeconds` to suit this.
850-
1. The kubelet triggers the container runtime to send a TERM signal to process 1 inside each
851-
container.
852-
The containers in the Pod receive the TERM signal at different times and in an arbitrary
853-
order. If the order of shutdowns matters, consider using a `preStop` hook to synchronize.
854848
-->
849+
855850
1. 如果 Pod 中的容器之一定义了 `preStop`
856851
[回调](/zh-cn/docs/concepts/containers/container-lifecycle-hooks)
857852
`kubelet` 开始在容器内运行该回调逻辑。如果超出体面终止限期时,
858853
`preStop` 回调逻辑仍在运行,`kubelet` 会请求给予该 Pod 的宽限期一次性增加 2 秒钟。
859854

860855
{{< note >}}
856+
<!--
857+
If the `preStop` hook needs longer to complete than the default grace period allows,
858+
you must modify `terminationGracePeriodSeconds` to suit this.
859+
-->
861860
如果 `preStop` 回调所需要的时间长于默认的体面终止限期,你必须修改
862861
`terminationGracePeriodSeconds` 属性值来使其正常工作。
863862
{{< /note >}}
863+
864+
<!--
865+
1. The kubelet triggers the container runtime to send a TERM signal to process 1 inside each
866+
container.
867+
-->
864868

865-
1. `kubelet` 接下来触发容器运行时发送 TERM 信号给每个容器中的进程 1。
869+
2. `kubelet` 接下来触发容器运行时发送 TERM 信号给每个容器中的进程 1。
866870

867871
{{< note >}}
872+
<!--
873+
The containers in the Pod receive the TERM signal at different times and in an arbitrary
874+
order. If the order of shutdowns matters, consider using a `preStop` hook to synchronize.
875+
-->
868876
Pod 中的容器会在不同时刻收到 TERM 信号,接收顺序也是不确定的。
869877
如果关闭的顺序很重要,可以考虑使用 `preStop` 回调逻辑来协调。
870878
{{< /note >}}
871879

872880
<!--
873881
1. At the same time as the kubelet is starting graceful shutdown, the control plane removes that
874-
shutting-down Pod from Endpoints (and, if enabled, EndpointSlice) objects where these represent
882+
shutting-down Pod from EndpointSlice (and Endpoints) objects where these represent
875883
a {{< glossary_tooltip term_id="service" text="Service" >}} with a configured
876884
{{< glossary_tooltip text="selector" term_id="selector" >}}.
877885
{{< glossary_tooltip text="ReplicaSets" term_id="replica-set" >}} and other workload resources
878886
no longer treat the shutting-down Pod as a valid, in-service replica. Pods that shut down slowly
879887
cannot continue to serve traffic as load balancers (like the service proxy) remove the Pod from
880888
the list of endpoints as soon as the termination grace period _begins_.
881889
-->
882-
3. 与此同时,`kubelet` 启动体面关闭逻辑,控制面会将 Pod 从对应的端点列表(以及端点切片列表,
883-
如果启用了的话)中移除,过滤条件是 Pod 被对应的
884-
{{< glossary_tooltip term_id="service" text="服务" >}}以某
890+
3. `kubelet` 启动体面关闭逻辑的同时,控制面会将关闭的 Pod 从对应的
891+
EndpointSlice(和 Endpoints)对象中移除,过滤条件是 Pod
892+
被对应的{{< glossary_tooltip term_id="service" text="服务" >}}以某
885893
{{< glossary_tooltip text="选择算符" term_id="selector" >}}选定。
886-
{{< glossary_tooltip text="ReplicaSets" term_id="replica-set" >}}
894+
{{< glossary_tooltip text="ReplicaSet" term_id="replica-set" >}}
887895
和其他工作负载资源不再将关闭进程中的 Pod 视为合法的、能够提供服务的副本。
888896
关闭动作很慢的 Pod 也无法继续处理请求数据,
889897
因为负载均衡器(例如服务代理)已经在终止宽限期开始的时候将其从端点列表中移除。
@@ -907,19 +915,21 @@ An example flow:
907915

908916
<!--
909917
### Forced Pod termination {#pod-termination-forced}
910-
911-
Forced deletions can be potentially disruptive for some workloads and their Pods.
912-
913-
By default, all deletes are graceful within 30 seconds. The `kubectl delete` command supports
914-
the `--grace-period=<seconds>` option which allows you to override the default and specify your
915-
own value.
916918
-->
917919
### 强制终止 Pod {#pod-termination-forced}
918920

919921
{{< caution >}}
922+
<!--
923+
Forced deletions can be potentially disruptive for some workloads and their Pods.
924+
-->
920925
对于某些工作负载及其 Pod 而言,强制删除很可能会带来某种破坏。
921926
{{< /caution >}}
922927

928+
<!--
929+
By default, all deletes are graceful within 30 seconds. The `kubectl delete` command supports
930+
the `--grace-period=<seconds>` option which allows you to override the default and specify your
931+
own value.
932+
-->
923933
默认情况下,所有的删除操作都会附有 30 秒钟的宽限期限。
924934
`kubectl delete` 命令支持 `--grace-period=<seconds>` 选项,允许你重载默认值,
925935
设定自己希望的期限值。
@@ -932,12 +942,11 @@ begin immediate cleanup.
932942
将宽限期限强制设置为 `0` 意味着立即从 API 服务器删除 Pod。
933943
如果 Pod 仍然运行于某节点上,强制删除操作会触发 `kubelet` 立即执行清理操作。
934944

945+
{{< note >}}
935946
<!--
936947
You must specify an additional flag `--force` along with `--grace-period=0` in order to perform force deletions.
937948
-->
938-
{{< note >}}
939-
你必须在设置 `--grace-period=0` 的同时额外设置 `--force`
940-
参数才能发起强制删除请求。
949+
你必须在设置 `--grace-period=0` 的同时额外设置 `--force` 参数才能发起强制删除请求。
941950
{{< /note >}}
942951

943952
<!--

0 commit comments

Comments
 (0)