Skip to content

Commit 162e4f0

Browse files
authored
Merge pull request #38665 from windsonsea/conpdb
[zh] sync configure-pdb.md
2 parents e3aa80c + 5585629 commit 162e4f0

File tree

1 file changed

+93
-2
lines changed

1 file changed

+93
-2
lines changed

content/zh-cn/docs/tasks/run-application/configure-pdb.md

Lines changed: 93 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -231,10 +231,10 @@ is the `scale` of the controller managing the pods being selected by the
231231

232232
<!--
233233
Example 1: With a `minAvailable` of 5, evictions are allowed as long as they leave behind
234-
5 or more healthy pods among those selected by the PodDisruptionBudget's `selector`.
234+
5 or more [healthy](#healthiness-of-a-pod) pods among those selected by the PodDisruptionBudget's `selector`.
235235
-->
236236
示例 1:设置 `minAvailable` 值为 5 的情况下,驱逐时需保证 PodDisruptionBudget 的 `selector`
237-
选中的 Pod 中 5 个或 5 个以上处于健康状态
237+
选中的 Pod 中 5 个或 5 个以上处于[健康](#healthiness-of-a-pod)状态
238238

239239
<!--
240240
Example 2: With a `minAvailable` of 30%, evictions are allowed as long as at least 30%
@@ -407,6 +407,97 @@ status:
407407
observedGeneration: 1
408408
```
409409
410+
<!--
411+
### Healthiness of a Pod
412+
413+
The current implementation considers healthy pods, as pods that have `.status.conditions` item with `type="Ready"` and `status="True"`.
414+
These pods are tracked via `.status.currentHealthy` field in the PDB status.
415+
-->
416+
### Pod 的健康 {#healthiness-of-a-pod}
417+
418+
如果 Pod 的 `.status.conditions` 中包含 `type="Ready"` 和 `status="True"` 的项,
419+
则当前实现将其视为健康的 Pod。这些 Pod 通过 PDB 状态中的 `.status.currentHealthy` 字段被跟踪。
420+
421+
<!--
422+
## Unhealthy Pod Eviction Policy
423+
-->
424+
## 不健康的 Pod 驱逐策略 {#unhealthy-pod-eviction-policy}
425+
426+
{{< feature-state for_k8s_version="v1.26" state="alpha" >}}
427+
428+
{{< note >}}
429+
<!--
430+
In order to use this behavior, you must enable the `PDBUnhealthyPodEvictionPolicy`
431+
[feature gate](/docs/reference/command-line-tools-reference/feature-gates/)
432+
on the [API server](/docs/reference/command-line-tools-reference/kube-apiserver/).
433+
-->
434+
为了使用此行为,你必须在
435+
[API 服务器](/zh-cn/docs/reference/command-line-tools-reference/kube-apiserver/)上启用
436+
`PDBUnhealthyPodEvictionPolicy`
437+
[特性门控](/zh-cn/docs/reference/command-line-tools-reference/feature-gates/)。
438+
{{< /note >}}
439+
440+
<!--
441+
PodDisruptionBudget guarding an application ensures that `.status.currentHealthy` number of pods
442+
does not fall below the number specified in `.status.desiredHealthy` by disallowing eviction of healthy pods.
443+
By using `.spec.unhealthyPodEvictionPolicy`, you can also define the criteria when unhealthy pods
444+
should be considered for eviction. The default behavior when no policy is specified corresponds
445+
to the `IfHealthyBudget` policy.
446+
-->
447+
守护应用程序的 PodDisruptionBudget 通过不允许驱逐健康的 Pod 来确保 `.status.currentHealthy` 的 Pod
448+
数量不低于 `.status.desiredHealthy` 中指定的数量。通过使用 `.spec.unhealthyPodEvictionPolicy`,
449+
你还可以定义条件来判定何时应考虑驱逐不健康的 Pod。未指定策略时的默认行为对应于 `IfHealthyBudget` 策略。
450+
451+
<!--
452+
Policies:
453+
-->
454+
策略包含:
455+
456+
<!--
457+
`IfHealthyBudget`
458+
: Running pods (`.status.phase="Running"`), but not yet healthy can be evicted only if the guarded application is not
459+
disrupted (`.status.currentHealthy` is at least equal to `.status.desiredHealthy`).
460+
461+
: This policy ensures that running pods of an already disrupted application have the best chance to become healthy.
462+
This has negative implications for draining nodes, which can be blocked by misbehaving applications that are guarded by a PDB.
463+
More specifically applications with pods in `CrashLoopBackOff` state (due to a bug or misconfiguration),
464+
or pods that are just failing to report the `Ready` condition.
465+
-->
466+
`IfHealthyBudget`
467+
: 对于运行中但还不健康的 Pod(`.status.phase="Running"`),只有所守护的应用程序不受干扰
468+
(`.status.currentHealthy` 至少等于 `.status.desiredHealthy`)时才能被驱逐。
469+
470+
: 此策略确保已受干扰的应用程序所运行的 Pod 会尽可能成为健康。
471+
这对排空节点有负面影响,可能会因 PDB 守护的应用程序行为错误而阻止排空。
472+
更具体地说,这些应用程序的 Pod 处于 `CrashLoopBackOff` 状态
473+
(由于漏洞或错误配置)或其 Pod 只是未能报告 `Ready` 状况。
474+
475+
<!--
476+
`AlwaysAllow`
477+
: Running pods (`.status.phase="Running"`), but not yet healthy are considered disrupted and can be evicted
478+
regardless of whether the criteria in a PDB is met.
479+
480+
: This means prospective running pods of a disrupted application might not get a chance to become healthy.
481+
By using this policy, cluster managers can easily evict misbehaving applications that are guarded by a PDB.
482+
More specifically applications with pods in `CrashLoopBackOff` state (due to a bug or misconfiguration),
483+
or pods that are just failing to report the `Ready` condition.
484+
-->
485+
`AlwaysAllow`
486+
: 运行中但还不健康的 Pod(`.status.phase="Running"`)将被视为已受干扰且可以被驱逐,
487+
与是否满足 PDB 中的判决条件无关。
488+
489+
: 这意味着受干扰的应用程序所运行的 Pod 可能没有机会恢复健康。
490+
通过使用此策略,集群管理器可以轻松驱逐由 PDB 所守护的行为错误的应用程序。
491+
更具体地说,这些应用程序的 Pod 处于 `CrashLoopBackOff` 状态
492+
(由于漏洞或错误配置)或其 Pod 只是未能报告 `Ready` 状况。
493+
494+
{{< note >}}
495+
<!--
496+
Pods in `Pending`, `Succeeded` or `Failed` phase are always considered for eviction.
497+
-->
498+
处于`Pending`、`Succeeded` 或 `Failed` 阶段的 Pod 总是被考虑驱逐。
499+
{{< /note >}}
500+
410501
<!--
411502
## Arbitrary Controllers and Selectors
412503

0 commit comments

Comments
 (0)