Skip to content

Commit 7e6d538

Browse files
authored
Merge pull request #43221 from qlijin/sync_pods
[zh-cn] sync concepts/workloads/pods/*
2 parents 2e17822 + cb324fb commit 7e6d538

File tree

3 files changed

+46
-54
lines changed

3 files changed

+46
-54
lines changed

content/zh-cn/docs/concepts/workloads/pods/init-containers.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ Init 容器的状态在 `status.initContainerStatuses` 字段中以容器状态
8787
Init containers support all the fields and features of app containers,
8888
including resource limits, [volumes](/docs/concepts/storage/volumes/), and security settings. However, the
8989
resource requests and limits for an init container are handled differently,
90-
as documented in [Resources](#resources).
90+
as documented in [Resource sharing within containers](#resource-sharing-within-containers).
9191
9292
Also, init containers do not support `lifecycle`, `livenessProbe`, `readinessProbe`, or
9393
`startupProbe` because they must run to completion before the Pod can be ready.
@@ -101,7 +101,8 @@ the application containers for the Pod and runs them as usual.
101101

102102
Init 容器支持应用容器的全部字段和特性,包括资源限制、
103103
[数据卷](/zh-cn/docs/concepts/storage/volumes/)和安全设置。
104-
然而,Init 容器对资源请求和限制的处理稍有不同,在下面[资源](#resources)节有说明。
104+
然而,Init 容器对资源请求和限制的处理稍有不同,
105+
在下面[容器内的资源共享](#resource-sharing-within-containers)节有说明。
105106

106107
同时 Init 容器不支持 `lifecycle``livenessProbe``readinessProbe``startupProbe`
107108
因为它们必须在 Pod 就绪之前运行完成。

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

Lines changed: 34 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -327,7 +327,7 @@ Kubelet 管理以下 PodCondition:
327327

328328
<!--
329329
* `PodScheduled`: the Pod has been scheduled to a node.
330-
* `PodHasNetwork`: (alpha feature; must be [enabled explicitly](#pod-has-network)) the
330+
* `PodReadyToStartContainers`: (alpha feature; must be [enabled explicitly](#pod-has-network)) the
331331
Pod sandbox has been successfully created and networking configured.
332332
* `ContainersReady`: all containers in the Pod are ready.
333333
* `Initialized`: all [init containers](/docs/concepts/workloads/pods/init-containers/)
@@ -336,7 +336,7 @@ Kubelet 管理以下 PodCondition:
336336
balancing pools of all matching Services.
337337
-->
338338
* `PodScheduled`:Pod 已经被调度到某节点;
339-
* `PodHasNetwork`:Pod 沙箱被成功创建并且配置了网络(Alpha 特性,必须被[显式启用](#pod-has-network));
339+
* `PodReadyToStartContainers`:Pod 沙箱被成功创建并且配置了网络(Alpha 特性,必须被[显式启用](#pod-has-network));
340340
* `ContainersReady`:Pod 中所有容器都已就绪;
341341
* `Initialized`:所有的 [Init 容器](/zh-cn/docs/concepts/workloads/pods/init-containers/)都已成功完成;
342342
* `Ready`:Pod 可以为请求提供服务,并且应该被添加到对应服务的负载均衡池中。
@@ -462,29 +462,36 @@ When a Pod's containers are Ready but at least one custom condition is missing o
462462

463463
{{< feature-state for_k8s_version="v1.25" state="alpha" >}}
464464

465+
{{< note >}}
466+
<!--
467+
This condition was renamed from PodHasNetwork to PodReadyToStartContainers.
468+
-->
469+
这种状况已从 PodHasNetwork 重命名为 PodReadyToStartContainers。
470+
{{< /note >}}
471+
465472
<!--
466473
After a Pod gets scheduled on a node, it needs to be admitted by the Kubelet and
467474
have any volumes mounted. Once these phases are complete, the Kubelet works with
468475
a container runtime (using {{< glossary_tooltip term_id="cri" >}}) to set up a
469-
runtime sandbox and configure networking for the Pod. If the `PodHasNetworkCondition`
470-
[feature gate](/docs/reference/command-line-tools-reference/feature-gates/) is enabled,
471-
Kubelet reports whether a Pod has reached this initialization milestone through
472-
the `PodHasNetwork` condition in the `status.conditions` field of a Pod.
476+
runtime sandbox and configure networking for the Pod. If the
477+
`PodReadyToStartContainersCondition` [feature gate](/docs/reference/command-line-tools-reference/feature-gates/) is enabled,
478+
Kubelet reports whether a pod has reached this initialization milestone through
479+
the `PodReadyToStartContainers` condition in the `status.conditions` field of a Pod.
473480
-->
474481
在 Pod 被调度到某节点后,它需要被 Kubelet 接受并且挂载所需的卷。
475482
一旦这些阶段完成,Kubelet 将与容器运行时(使用{{< glossary_tooltip term_id="cri" >}})
476-
一起为 Pod 生成运行时沙箱并配置网络。如果启用了
477-
`PodHasNetworkCondition` [特性门控](/zh-cn/docs/reference/command-line-tools-reference/feature-gates/)
478-
kubelet 会通过 Pod 的 `status.conditions` 字段中的 `PodHasNetwork` 状况来报告
483+
一起为 Pod 生成运行时沙箱并配置网络。如果启用了 `PodReadyToStartContainersCondition`
484+
[特性门控](/zh-cn/docs/reference/command-line-tools-reference/feature-gates/)
485+
kubelet 会通过 Pod 的 `status.conditions` 字段中的 `PodReadyToStartContainers` 状况来报告
479486
Pod 是否达到了初始化里程碑。
480487

481488
<!--
482-
The `PodHasNetwork` condition is set to `False` by the Kubelet when it detects a
489+
The `PodReadyToStartContainers` condition is set to `False` by the Kubelet when it detects a
483490
Pod does not have a runtime sandbox with networking configured. This occurs in
484491
the following scenarios:
485492
-->
486-
当 kubelet 检测到 Pod 不具备配置了网络的运行时沙箱时,`PodHasNetwork` 状况将被设置为 `False`
487-
以下场景中将会发生这种状况:
493+
当 kubelet 检测到 Pod 不具备配置了网络的运行时沙箱时,`PodReadyToStartContainers`
494+
状况将被设置为 `False`以下场景中将会发生这种状况:
488495

489496
<!--
490497
- Early in the lifecycle of the Pod, when the kubelet has not yet begun to set up a sandbox for
@@ -501,14 +508,14 @@ the following scenarios:
501508
* 对于使用虚拟机进行隔离的容器运行时,Pod 沙箱虚拟机重启时,需要创建一个新的沙箱和全新的容器网络配置。
502509

503510
<!--
504-
The `PodHasNetwork` condition is set to `True` by the kubelet after the
511+
The `PodReadyToStartContainers` condition is set to `True` by the kubelet after the
505512
successful completion of sandbox creation and network configuration for the Pod
506513
by the runtime plugin. The kubelet can start pulling container images and create
507-
containers after `PodHasNetwork` condition has been set to `True`.
514+
containers after `PodReadyToStartContainers` condition has been set to `True`.
508515
-->
509516
在运行时插件成功完成 Pod 的沙箱创建和网络配置后,
510-
kubelet 会将 `PodHasNetwork` 状况设置为 `True`
511-
`PodHasNetwork` 状况设置为 `True` 后,
517+
kubelet 会将 `PodReadyToStartContainers` 状况设置为 `True`
518+
`PodReadyToStartContainers` 状况设置为 `True` 后,
512519
Kubelet 可以开始拉取容器镜像和创建容器。
513520

514521
<!--
@@ -831,16 +838,18 @@ shutdown.
831838
Pod。
832839

833840
<!--
834-
Typically, the container runtime sends a TERM signal to the main process in each
835-
container. Many container runtimes respect the `STOPSIGNAL` value defined in the container
836-
image and send this instead of TERM.
837-
Once the grace period has expired, the KILL signal is sent to any remaining processes, and the Pod
838-
is then deleted from the {{< glossary_tooltip text="API Server" term_id="kube-apiserver" >}}.
839-
If the kubelet or the container runtime's management service is restarted while waiting for
840-
processes to terminate, the cluster retries from the start including the full original grace period.
841+
Typically, with this graceful termination of the pod, kubelet makes requests to the container runtime to attempt to stop the containers in the pod by first sending a TERM (aka. SIGTERM) signal, with a grace period timeout, to the main process in each container. The requests to stop the containers are processed by the container runtime asynchronously. There is no guarantee to the order of processing for these requests. Many container runtimes respect the `STOPSIGNAL` value defined in the container image and, if different, send the container image configured STOPSIGNAL instead of TERM.
842+
Once the grace period has expired, the KILL signal is sent to any remaining
843+
processes, and the Pod is then deleted from the
844+
{{< glossary_tooltip text="API Server" term_id="kube-apiserver" >}}. If the kubelet or the
845+
container runtime's management service is restarted while waiting for processes to terminate, the
846+
cluster retries from the start including the full original grace period.
841847
-->
842-
通常情况下,容器运行时会发送一个 TERM 信号到每个容器中的主进程。
843-
很多容器运行时都能够注意到容器镜像中 `STOPSIGNAL` 的值,并发送该信号而不是 TERM。
848+
通常 Pod 体面终止的过程为:kubelet 先发送一个带有体面超时限期的 TERM(又名 SIGTERM)
849+
信号到每个容器中的主进程,将请求发送到容器运行时来尝试停止 Pod 中的容器。
850+
停止容器的这些请求由容器运行时以异步方式处理。
851+
这些请求的处理顺序无法被保证。许多容器运行时遵循容器镜像内定义的 `STOPSIGNAL` 值,
852+
如果不同,则发送容器镜像中配置的 STOPSIGNAL,而不是 TERM 信号。
844853
一旦超出了体面终止限期,容器运行时会向所有剩余进程发送 KILL 信号,之后
845854
Pod 就会被从 {{< glossary_tooltip text="API 服务器" term_id="kube-apiserver" >}}上移除。
846855
如果 `kubelet` 或者容器运行时的管理服务在等待进程终止期间被重启,

content/zh-cn/docs/concepts/workloads/pods/user-namespaces.md

Lines changed: 9 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -83,18 +83,18 @@ tmpfs、overlayfs。
8383
<!--
8484
In addition, support is needed in the
8585
{{< glossary_tooltip text="container runtime" term_id="container-runtime" >}}
86-
to use this feature with Kubernetes stateless pods:
86+
to use this feature with Kubernetes pods:
8787
8888
* CRI-O: version 1.25 (and later) supports user namespaces for containers.
8989
-->
9090

9191
此外,需要在{{< glossary_tooltip text="容器运行时" term_id="container-runtime" >}}提供支持,
92-
才能在 Kubernetes 无状态 Pod 中使用这一功能:
92+
才能在 Kubernetes Pod 中使用这一功能:
9393

9494
* CRI-O:1.25(及更高)版本支持配置容器的用户命名空间。
9595

9696
<!--
97-
containerd v1.7 is not compatible with the userns support in Kubernetes v{{< skew currentVersion >}}.
97+
containerd v1.7 is not compatible with the userns support in Kubernetes v1.27 to v{{< skew latestVersion >}}.
9898
Kubernetes v1.25 and v1.26 used an earlier implementation that **is** compatible with containerd v1.7,
9999
in terms of userns support.
100100
If you are using a version of Kubernetes other than {{< skew currentVersion >}},
@@ -105,7 +105,8 @@ documentation for compatibility information.
105105
You can see the status of user namespaces support in cri-dockerd tracked in an [issue][CRI-dockerd-issue]
106106
on GitHub.
107107
-->
108-
containerd v1.7 与 Kubernetes v{{< skew currentVersion >}} 中的用户命名空间不兼容。
108+
containerd v1.7 与 Kubernetes v1.27 至 v{{< skew currentVersion >}}
109+
版本中的用户命名空间不兼容。
109110
Kubernetes v1.25 和 v1.26 使用了早期的实现,在用户命名空间方面与 containerd v1.7 兼容。
110111
如果你使用的 Kubernetes 版本不是 {{< skew currentVersion >}},请查看该版本 Kubernetes
111112
的文档以获取更准确的信息。
@@ -134,7 +135,7 @@ to `false`.
134135

135136
<!--
136137
The kubelet will pick host UIDs/GIDs a pod is mapped to, and will do so in a way
137-
to guarantee that no two stateless pods on the same node use the same mapping.
138+
to guarantee that no two pods on the same node use the same mapping.
138139
139140
The `runAsUser`, `runAsGroup`, `fsGroup`, etc. fields in the `pod.spec` always
140141
refer to the user inside the container.
@@ -143,7 +144,7 @@ The valid UIDs/GIDs when this feature is enabled is the range 0-65535. This
143144
applies to files and processes (`runAsUser`, `runAsGroup`, etc.).
144145
-->
145146
kubelet 将挑选 Pod 所映射的主机 UID/GID,
146-
并将以保证同一节点上没有两个无状态 Pod 使用相同的映射的方式进行
147+
并以此保证同一节点上没有两个 Pod 使用相同的方式进行映射
147148

148149
`pod.spec` 中的 `runAsUser``runAsGroup``fsGroup` 等字段总是指的是容器内的用户。
149150
启用该功能时,有效的 UID/GID 在 0-65535 范围内。这以限制适用于文件和进程(`runAsUser``runAsGroup` 等)。
@@ -166,9 +167,9 @@ if user namespaces is activated.
166167
在用户命名空间被启用时,应该可以继续正常运行,不需要做任何改变。
167168

168169
<!--
169-
## Understanding user namespaces for stateless pods
170+
## Understanding user namespaces for pods {#pods-and-userns}
170171
-->
171-
## 了解无状态 Pod 的用户命名空间 {#understanding-user-namespaces-for-stateless-pods}
172+
## 了解 Pod 的用户命名空间 {#pods-and-userns}
172173

173174
<!--
174175
Several container runtimes with their default configuration (like Docker Engine,
@@ -299,25 +300,6 @@ allowed to set any of:
299300
* `hostIPC: true`
300301
* `hostPID: true`
301302

302-
<!--
303-
The pod is allowed to use no volumes at all or, if using volumes, only these
304-
volume types are allowed:
305-
306-
* configmap
307-
* secret
308-
* projected
309-
* downwardAPI
310-
* emptyDir
311-
-->
312-
313-
Pod 完全不使用卷是被允许的;如果使用卷,只允许使用以下卷类型:
314-
315-
* configmap
316-
* secret
317-
* projected
318-
* downwardAPI
319-
* emptyDir
320-
321303
## {{% heading "whatsnext" %}}
322304

323305
<!--

0 commit comments

Comments
 (0)