Skip to content

Commit 07834c2

Browse files
authored
Merge pull request #49112 from windsonsea/podcycle
[zh] Add zh text to pods/pod-lifecycle.md and related feature gate
2 parents ab05b49 + b91ae5f commit 07834c2

File tree

2 files changed

+93
-12
lines changed

2 files changed

+93
-12
lines changed

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

Lines changed: 75 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -315,7 +315,7 @@ data.
315315
When you use `kubectl` to query a Pod with a container that is `Waiting`, you also see
316316
a Reason field to summarize why the container is in that state.
317317
-->
318-
### `Waiting` (等待) {#container-state-waiting}
318+
### `Waiting`(等待) {#container-state-waiting}
319319

320320
如果容器并不处在 `Running``Terminated` 状态之一,它就处在 `Waiting` 状态。
321321
处于 `Waiting` 状态的容器仍在运行它完成启动所需要的操作:例如,
@@ -381,13 +381,12 @@ Kubernetes 通过在 Pod `spec` 中定义的 [`restartPolicy`](#restart-policy)
381381
(e.g., 10 minutes), Kubernetes resets the backoff delay, treating any new crash
382382
as the first one.
383383
-->
384-
385384
1. **最初的崩溃**:Kubernetes 尝试根据 Pod 的 `restartPolicy` 立即重新启动。
386385
1. **反复的崩溃**:在最初的崩溃之后,Kubernetes 对于后续重新启动的容器采用指数级回退延迟机制,
387-
[`restartPolicy`](#restart-policy) 中所述。
388-
这一机制可以防止快速、重复的重新启动尝试导致系统过载。
386+
[`restartPolicy`](#restart-policy) 中所述。
387+
这一机制可以防止快速、重复的重新启动尝试导致系统过载。
389388
1. **CrashLoopBackOff 状态**:这一状态表明,对于一个给定的、处于崩溃循环、反复失效并重启的容器,
390-
回退延迟机制目前正在生效。
389+
回退延迟机制目前正在生效。
391390
1. **回退重置**:如果容器成功运行了一定时间(如 10 分钟),
392391
Kubernetes 会重置回退延迟机制,将新的崩溃视为第一次崩溃。
393392
<!--
@@ -448,13 +447,13 @@ To investigate the root cause of a `CrashLoopBackOff` issue, a user can:
448447
要调查 `CrashLoopBackOff` 问题的根本原因,用户可以:
449448

450449
1. **检查日志**:使用 `kubectl logs <pod名称>` 检查容器的日志。
451-
这通常是诊断导致崩溃的问题的最直接方法。
450+
这通常是诊断导致崩溃的问题的最直接方法。
452451
1. **检查事件**:使用 `kubectl describe pod <pod名称>` 查看 Pod 的事件,
453-
这可以提供有关配置或资源问题的提示。
452+
这可以提供有关配置或资源问题的提示。
454453
1. **审查配置**:确保 Pod 配置正确无误,包括环境变量和挂载卷,并且所有必需的外部资源都可用。
455454
1. **检查资源限制**: 确保容器被分配了足够的 CPU 和内存。有时,增加 Pod 定义中的资源可以解决问题。
456455
1. **调试应用程序**:应用程序代码中可能存在错误或配置不当。
457-
在本地或开发环境中运行此容器镜像有助于诊断应用程序的特定问题。
456+
在本地或开发环境中运行此容器镜像有助于诊断应用程序的特定问题。
458457

459458
<!--
460459
### Container restart policy {#restart-policy}
@@ -510,6 +509,71 @@ kubelet 就会重置该容器的重启延迟计时器。
510509
[Sidecar 容器和 Pod 生命周期](/zh-cn/docs/concepts/workloads/pods/sidecar-containers/#sidecar-containers-and-pod-lifecycle)中解释了
511510
`init containers` 在指定 `restartpolicy` 字段时的行为。
512511

512+
<!--
513+
### Configurable container restart delay
514+
-->
515+
### 可配置的容器重启延迟 {#configurable-container-restart-delay}
516+
517+
{{< feature-state feature_gate_name="KubeletCrashLoopBackOffMax" >}}
518+
519+
<!--
520+
With the alpha feature gate `KubeletCrashLoopBackOffMax` enabled, you can
521+
reconfigure the maximum delay between container start retries from the default
522+
of 300s (5 minutes). This configuration is set per node using kubelet
523+
configuration. In your [kubelet configuration](/docs/tasks/administer-cluster/kubelet-config-file/),
524+
under `crashLoopBackOff` set the `maxContainerRestartPeriod` field between
525+
`"1s"` and `"300s"`. As described above in [Container restart
526+
policy](#restart-policy), delays on that node will still start at 10s and
527+
increase exponentially by 2x each restart, but will now be capped at your
528+
configured maximum. If the `maxContainerRestartPeriod` you configure is less
529+
than the default initial value of 10s, the initial delay will instead be set to
530+
the configured maximum.
531+
-->
532+
启用 Alpha 特性门控 `KubeletCrashLoopBackOffMax` 后,
533+
你可以重新配置容器启动重试之间的最大延迟,默认值为 300 秒(5 分钟)。
534+
此配置是针对每个节点使用 kubelet 配置进行设置的。
535+
在你的 [kubelet 配置](/zh-cn/docs/tasks/administer-cluster/kubelet-config-file/)中,
536+
`crashLoopBackOff` 下设置 `maxContainerRestartPeriod` 字段,取值范围在 `"1s"``"300s"` 之间。
537+
如上文[容器重启策略](#restart-policy)所述,该节点上的延迟仍将从 10 秒开始,并在每次重启后以指数方式增加
538+
2 倍,但现在其上限将被限制为你所配置的最大值。如果你配置的 `maxContainerRestartPeriod` 小于默认初始值 10 秒,
539+
则初始延迟将被设置为配置的最大值。
540+
541+
<!--
542+
See the following kubelet configuration examples:
543+
544+
```yaml
545+
# container restart delays will start at 10s, increasing
546+
# 2x each time they are restarted, to a maximum of 100s
547+
kind: KubeletConfiguration
548+
crashLoopBackOff:
549+
maxContainerRestartPeriod: "100s"
550+
```
551+
-->
552+
参见以下 kubelet 配置示例:
553+
554+
```yaml
555+
# 容器重启延迟将从 10 秒开始,每次重启增加 2 倍
556+
# 最高达到 100 秒
557+
kind: KubeletConfiguration
558+
crashLoopBackOff:
559+
maxContainerRestartPeriod: "100s"
560+
```
561+
562+
<!--
563+
```yaml
564+
# delays between container restarts will always be 2s
565+
kind: KubeletConfiguration
566+
crashLoopBackOff:
567+
maxContainerRestartPeriod: "2s"
568+
```
569+
-->
570+
```yaml
571+
# 容器重启之间的延迟将始终为 2 秒
572+
kind: KubeletConfiguration
573+
crashLoopBackOff:
574+
maxContainerRestartPeriod: "2s"
575+
```
576+
513577
<!--
514578
## Pod conditions
515579
@@ -1311,8 +1375,7 @@ Additionally, PodGC cleans up any Pods which satisfy any of the following condit
13111375
1. are orphan Pods - bound to a node which no longer exists,
13121376
1. are unscheduled terminating Pods,
13131377
1. are terminating Pods, bound to a non-ready node tainted with
1314-
[`node.kubernetes.io/out-of-service`](/docs/reference/labels-annotations-taints/#node-kubernetes-io-out-of-service),
1315-
when the `NodeOutOfServiceVolumeDetach` feature gate is enabled.
1378+
[`node.kubernetes.io/out-of-service`](/docs/reference/labels-annotations-taints/#node-kubernetes-io-out-of-service).
13161379

13171380
Along with cleaning up the Pods, PodGC will also mark them as failed if they are in a non-terminal
13181381
phase. Also, PodGC adds a Pod disruption condition when cleaning up an orphan Pod.
@@ -1323,8 +1386,8 @@ for more details.
13231386

13241387
1. 孤儿 Pod - 绑定到不再存在的节点,
13251388
2. 计划外终止的 Pod
1326-
3. 终止过程中的 Pod,当启用 `NodeOutOfServiceVolumeDetach` 特性门控时,
1327-
绑定到有 [`node.kubernetes.io/out-of-service`](/zh-cn/docs/reference/labels-annotations-taints/#node-kubernetes-io-out-of-service)
1389+
3. 终止过程中的 Pod,绑定到有
1390+
[`node.kubernetes.io/out-of-service`](/zh-cn/docs/reference/labels-annotations-taints/#node-kubernetes-io-out-of-service)
13281391
污点的未就绪节点。
13291392

13301393
在清理 Pod 的同时,如果它们处于非终止状态阶段,PodGC 也会将它们标记为失败。
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
---
2+
title: KubeletCrashLoopBackOffMax
3+
content_type: feature_gate
4+
_build:
5+
list: never
6+
render: false
7+
8+
stages:
9+
- stage: alpha
10+
defaultValue: false
11+
fromVersion: "1.32"
12+
---
13+
14+
<!--
15+
Enables support for configurable per-node backoff maximums for restarting
16+
containers in the CrashLoopBackOff state.
17+
-->
18+
启用对可逐节点配置的、在重启 CrashLoopBackOff 状态的容器时回退最大值的支持。

0 commit comments

Comments
 (0)