[zh] Sync cluster-administration/node-shutdown.md and its feature gate

This commit is contained in:
windsonsea 2024-12-17 09:29:28 +08:00
parent 4205833245
commit 222f7b3870
2 changed files with 84 additions and 21 deletions

View File

@ -70,7 +70,7 @@ To activate the feature, the two kubelet config settings should be configured ap
set to non-zero values. set to non-zero values.
--> -->
注意,默认情况下,下面描述的两个配置选项,`shutdownGracePeriod` 和 注意,默认情况下,下面描述的两个配置选项,`shutdownGracePeriod` 和
`shutdownGracePeriodCriticalPods` 都是被设置为 0 的,因此不会激活节点体面关闭功能 `shutdownGracePeriodCriticalPods` 都是被设置为 0 的,因此不会激活节点体面关闭特性
要激活此功能特性,这两个 kubelet 配置选项要适当配置,并设置为非零值。 要激活此功能特性,这两个 kubelet 配置选项要适当配置,并设置为非零值。
<!-- <!--
@ -110,7 +110,7 @@ During a graceful shutdown, kubelet terminates pods in two phases:
2. Terminate [critical pods](/docs/tasks/administer-cluster/guaranteed-scheduling-critical-addon-pods/#marking-pod-as-critical) 2. Terminate [critical pods](/docs/tasks/administer-cluster/guaranteed-scheduling-critical-addon-pods/#marking-pod-as-critical)
running on the node. running on the node.
--> -->
在体面关闭节点过程中kubelet 分两个阶段来终止 Pod 在体面关闭过程中kubelet 分两个阶段来终止 Pod
1. 终止在节点上运行的常规 Pod。 1. 终止在节点上运行的常规 Pod。
2. 终止在节点上运行的[关键 Pod](/zh-cn/docs/tasks/administer-cluster/guaranteed-scheduling-critical-addon-pods/#marking-pod-as-critical)。 2. 终止在节点上运行的[关键 Pod](/zh-cn/docs/tasks/administer-cluster/guaranteed-scheduling-critical-addon-pods/#marking-pod-as-critical)。
@ -158,8 +158,7 @@ for gracefully terminating normal pods, and the last 10 seconds would be
reserved for terminating [critical pods](/docs/tasks/administer-cluster/guaranteed-scheduling-critical-addon-pods/#marking-pod-as-critical). reserved for terminating [critical pods](/docs/tasks/administer-cluster/guaranteed-scheduling-critical-addon-pods/#marking-pod-as-critical).
--> -->
例如,如果设置了 `shutdownGracePeriod=30s``shutdownGracePeriodCriticalPods=10s` 例如,如果设置了 `shutdownGracePeriod=30s``shutdownGracePeriodCriticalPods=10s`
则 kubelet 将延迟 30 秒关闭节点。 则 kubelet 将延迟 30 秒关闭节点。在关闭期间,将保留前 2030 - 10秒用于体面终止常规 Pod
在关闭期间,将保留前 2030 - 10秒用于体面终止常规 Pod
而保留最后 10 秒用于终止[关键 Pod](/zh-cn/docs/tasks/administer-cluster/guaranteed-scheduling-critical-addon-pods/#marking-pod-as-critical)。 而保留最后 10 秒用于终止[关键 Pod](/zh-cn/docs/tasks/administer-cluster/guaranteed-scheduling-critical-addon-pods/#marking-pod-as-critical)。
{{< note >}} {{< note >}}
@ -341,8 +340,8 @@ their respective shutdown periods.
使用此功能特性需要启用 `GracefulNodeShutdownBasedOnPodPriority` 使用此功能特性需要启用 `GracefulNodeShutdownBasedOnPodPriority`
[特性门控](/zh-cn/docs/reference/command-line-tools-reference/feature-gates/) [特性门控](/zh-cn/docs/reference/command-line-tools-reference/feature-gates/)
并将 [kubelet 配置](/zh-cn/docs/reference/config-api/kubelet-config.v1beta1/) 并将 [kubelet 配置](/zh-cn/docs/reference/config-api/kubelet-config.v1beta1/)中的
中的 `shutdownGracePeriodByPodPriority` 设置为期望的配置, `shutdownGracePeriodByPodPriority` 设置为期望的配置,
其中包含 Pod 的优先级类数值以及对应的关闭期限。 其中包含 Pod 的优先级类数值以及对应的关闭期限。
{{< note >}} {{< note >}}
@ -351,8 +350,8 @@ The ability to take Pod priority into account during graceful node shutdown was
as an Alpha feature in Kubernetes v1.23. In Kubernetes {{< skew currentVersion >}} as an Alpha feature in Kubernetes v1.23. In Kubernetes {{< skew currentVersion >}}
the feature is Beta and is enabled by default. the feature is Beta and is enabled by default.
--> -->
在节点体面关闭期间考虑 Pod 优先级的能力是作为 Kubernetes v1.23 中的 Alpha 功能引入的。 在节点体面关闭期间考虑 Pod 优先级的能力是作为 Kubernetes v1.23 中的 Alpha 特性引入的。
在 Kubernetes {{< skew currentVersion >}} 中该功能是 Beta 版,默认启用。 在 Kubernetes {{< skew currentVersion >}} 中此特性处于 Beta 阶段,默认启用。
{{< /note >}} {{< /note >}}
<!-- <!--
@ -406,21 +405,17 @@ these pods will be stuck in terminating status on the shutdown node forever.
如果原来的已关闭节点没有被恢复,那些在已关闭节点上的 Pod 将永远滞留在终止状态。 如果原来的已关闭节点没有被恢复,那些在已关闭节点上的 Pod 将永远滞留在终止状态。
<!-- <!--
To mitigate the above situation, a user can manually add the taint `node.kubernetes.io/out-of-service` with either `NoExecute` To mitigate the above situation, a user can manually add the taint `node.kubernetes.io/out-of-service`
or `NoSchedule` effect to a Node marking it out-of-service. with either `NoExecute` or `NoSchedule` effect to a Node marking it out-of-service.
If the `NodeOutOfServiceVolumeDetach`[feature gate](/docs/reference/command-line-tools-reference/feature-gates/) If a Node is marked out-of-service with this taint, the pods on the node will be forcefully deleted
is enabled on {{< glossary_tooltip text="kube-controller-manager" term_id="kube-controller-manager" >}}, and a Node is marked out-of-service with this taint, the if there are no matching tolerations on it and volume detach operations for the pods terminating on
pods on the node will be forcefully deleted if there are no matching tolerations on it and volume the node will happen immediately. This allows the Pods on the out-of-service node to recover quickly
detach operations for the pods terminating on the node will happen immediately. This allows the on a different node.
Pods on the out-of-service node to recover quickly on a different node.
--> -->
为了缓解上述情况,用户可以手动将具有 `NoExecute``NoSchedule` 效果的 为了缓解上述情况,用户可以手动将具有 `NoExecute``NoSchedule` 效果的
`node.kubernetes.io/out-of-service` 污点添加到节点上,标记其无法提供服务。 `node.kubernetes.io/out-of-service` 污点添加到节点上,标记其无法提供服务。
如果在 {{< glossary_tooltip text="kube-controller-manager" term_id="kube-controller-manager" >}} 如果 Node 被污点标记为无法提供服务,且节点上的 Pod 没有设置对应的容忍度,
上启用了 `NodeOutOfServiceVolumeDetach` 那么这样的 Pod 将被强制删除,并且在节点上被终止的 Pod 将立即进行卷分离操作。
[特性门控](/zh-cn/docs/reference/command-line-tools-reference/feature-gates/)
并且节点被污点标记为无法提供服务,如果节点 Pod 上没有设置对应的容忍度,
那么这样的 Pod 将被强制删除,并且该在节点上被终止的 Pod 将立即进行卷分离操作。
这样就允许那些在无法提供服务节点上的 Pod 能在其他节点上快速恢复。 这样就允许那些在无法提供服务节点上的 Pod 能在其他节点上快速恢复。
<!-- <!--
@ -505,6 +500,50 @@ via the [Non-Graceful Node Shutdown](#non-graceful-node-shutdown) procedure ment
- 偏离上述步骤可能会导致数据损坏。 - 偏离上述步骤可能会导致数据损坏。
{{< /note >}} {{< /note >}}
<!--
## Windows Graceful node shutdown {#windows-graceful-node-shutdown}
-->
## Windows 体面节点关闭 {#windows-graceful-node-shutdown}
{{< feature-state feature_gate_name="WindowsGracefulNodeShutdown" >}}
<!--
The Windows graceful node shutdown feature depends on kubelet running as a Windows service,
it will then have a registered [service control handler](https://learn.microsoft.com/en-us/windows/win32/services/service-control-handler-function)
to delay the presshutdown event with a given duration.
-->
此服务会使用一个注册的[服务控制处理程序函数](https://learn.microsoft.com/zh-cn/windows/win32/services/service-control-handler-function)将
preshutdown 事件延迟一段时间。
<!--
Windows graceful node shutdown is controlled with the `WindowsGracefulNodeShutdown`
[feature gate](/docs/reference/command-line-tools-reference/feature-gates/)
which is introduced in 1.32 as an alpha feature.
Windows graceful node shutdown can not be cancelled.
-->
Windows 体面节点关闭是通过 1.32 中作为 Alpha 特性所引入的 `WindowsGracefulNodeShutdown`
[特性门控](/zh-cn/docs/reference/command-line-tools-reference/feature-gates/)进行控制的。
Windows 体面节点关闭无法被取消。
<!--
If Kubelet is not running as a Windows service, it will not be able to set and monitor
the [Preshutdown](https://learn.microsoft.com/en-us/windows/win32/api/winsvc/ns-winsvc-service_preshutdown_info) event,
the node will have to go through the [Non-Graceful Node Shutdown](#non-graceful-node-shutdown) procedure mentioned above.
-->
如果 kubelet 不是作为 Windows 服务运行,它将不能设置和监控
[Preshutdown](https://learn.microsoft.com/zh-cn/windows/win32/api/winsvc/ns-winsvc-service_preshutdown_info)
事件,对应节点将不得不跑完上述[非体面节点关闭](#non-graceful-node-shutdown)的流程。
<!--
In the case where the Windows graceful node shutdown feature is enabled, but the kubelet is not
running as a Windows service, the kubelet will continue running instead of failing. However,
it will log an error indicating that it needs to be run as a Windows service.
-->
在启用 Windows 体面节点关闭特性但 kubelet 未作为 Windows 服务运行的情况下kubelet 将继续运行而不会失败。
但是kubelet 将在日志中记录一个错误,表明它需要作为一个 Windows 服务来运行。
## {{% heading "whatsnext" %}} ## {{% heading "whatsnext" %}}
<!-- <!--

View File

@ -0,0 +1,24 @@
---
title: WindowsGracefulNodeShutdown
content_type: feature_gate
_build:
list: never
render: false
stages:
- stage: alpha
defaultValue: false
fromVersion: "1.32"
---
<!--
Enables support for windows node graceful shutdown in kubelet.
During a system shutdown, kubelet will attempt to detect the shutdown event
and gracefully terminate pods running on the node. See
[Graceful Node Shutdown](/docs/concepts/architecture/nodes/#graceful-node-shutdown)
for more details.
-->
在 kubelet 中启用对 Windows 节点体面关闭的支持。
在系统关闭期间kubelet 将尝试检测关闭事件并体面终止节点上正运行的 Pod。
细节参见[体面节点关闭](/zh-cn/docs/concepts/architecture/nodes/#graceful-node-shutdown)。