Skip to content

Commit fe56be7

Browse files
committed
[zh-cn]sync node-shutdown.md
Signed-off-by: xin.li <[email protected]>
1 parent a188498 commit fe56be7

File tree

1 file changed

+74
-59
lines changed

1 file changed

+74
-59
lines changed

content/zh-cn/docs/concepts/cluster-administration/node-shutdown.md

Lines changed: 74 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,10 @@ either **graceful** or **non-graceful**.
2828
-->
2929
## 节点体面关闭 {#graceful-node-shutdown}
3030

31-
{{< feature-state feature_gate_name="GracefulNodeShutdown" >}}
32-
3331
<!--
3432
The kubelet attempts to detect node system shutdown and terminates pods running on the node.
3533
36-
kubelet ensures that pods follow the normal
34+
Kubelet ensures that pods follow the normal
3735
[pod termination process](/docs/concepts/workloads/pods/pod-lifecycle/#pod-termination)
3836
during the node shutdown. During node shutdown, the kubelet does not accept new
3937
Pods (even if those Pods are already bound to the node).
@@ -44,43 +42,104 @@ kubelet 会尝试检测节点系统关闭事件并终止在节点上运行的所
4442
[Pod 终止流程](/zh-cn/docs/concepts/workloads/pods/pod-lifecycle/#pod-termination)
4543
且不接受新的 Pod(即使这些 Pod 已经绑定到该节点)。
4644

47-
<!--
45+
<!--
46+
### Enabling graceful node shutdown
47+
-->
48+
## 启用节点体面关闭 {#enabling-graceful-node-shutdown}
49+
50+
{{< tabs name="graceful_shutdown_os" >}}
51+
{{% tab name="Linux" %}}
52+
{{< feature-state feature_gate_name="GracefulNodeShutdown" >}}
53+
54+
<!--
55+
On Linux, the graceful node shutdown feature is controlled with the `GracefulNodeShutdown`
56+
[feature gate](/docs/reference/command-line-tools-reference/feature-gates/) which is
57+
enabled by default in 1.21.
58+
-->
59+
在 Linux 上,节点体面关闭特性受 `GracefulNodeShutdown`
60+
[特性门控](/zh-cn/docs/reference/command-line-tools-reference/feature-gates/)控制,
61+
此特性在 1.21 版本中默认启用。
62+
63+
{{< note >}}
64+
<!--
4865
The graceful node shutdown feature depends on systemd since it takes advantage of
4966
[systemd inhibitor locks](https://www.freedesktop.org/wiki/Software/systemd/inhibit/) to
5067
delay the node shutdown with a given duration.
5168
-->
5269
节点体面关闭特性依赖于 systemd,因为它要利用
5370
[systemd 抑制器锁](https://www.freedesktop.org/wiki/Software/systemd/inhibit/)机制,
5471
在给定的期限内延迟节点关闭。
72+
{{</ note >}}
73+
{{% /tab %}}
74+
75+
{{% tab name="Windows" %}}
76+
{{< feature-state feature_gate_name="WindowsGracefulNodeShutdown" >}}
5577

5678
<!--
57-
Graceful node shutdown is controlled with the `GracefulNodeShutdown`
58-
[feature gate](/docs/reference/command-line-tools-reference/feature-gates/) which is
59-
enabled by default in 1.21.
79+
On Windows, the graceful node shutdown feature is controlled with the `WindowsGracefulNodeShutdown`
80+
[feature gate](/docs/reference/command-line-tools-reference/feature-gates/)
81+
which is introduced in 1.32 as an alpha feature. In Kubernetes 1.34 the feature is Beta
82+
and is enabled by default.
6083
-->
61-
节点体面关闭特性受 `GracefulNodeShutdown`
84+
在 Windows 上,节点体面关闭特性受 `WindowsGracefulNodeShutdown`
6285
[特性门控](/zh-cn/docs/reference/command-line-tools-reference/feature-gates/)控制,
63-
在 1.21 版本中是默认启用的
86+
此特性在 1.32 版本中作为 Alpha 特性引入,在 1.34 版本中变为 Beta 并且默认启用
6487

6588
<!--
89+
The Windows graceful node shutdown feature depends on kubelet running as a Windows service,
90+
it will then have a registered [service control handler](https://learn.microsoft.com/en-us/windows/win32/services/service-control-handler-function)
91+
to delay the preshutdown event with a given duration.
92+
-->
93+
此服务会使用一个注册的[服务控制处理程序函数](https://learn.microsoft.com/zh-cn/windows/win32/services/service-control-handler-function)
94+
preshutdown 事件延迟一段时间。
95+
96+
<!--
97+
Windows graceful node shutdown can not be cancelled.
98+
99+
If kubelet is not running as a Windows service, it will not be able to set and monitor
100+
the [Preshutdown](https://learn.microsoft.com/en-us/windows/win32/api/winsvc/ns-winsvc-service_preshutdown_info) event,
101+
the node will have to go through the [Non-Graceful Node Shutdown](#non-graceful-node-shutdown) procedure mentioned above.
102+
-->
103+
Windows 节点体面关闭无法被取消。
104+
105+
如果 kubelet 不是作为 Windows 服务运行,它将不能设置和监控
106+
[Preshutdown](https://learn.microsoft.com/zh-cn/windows/win32/api/winsvc/ns-winsvc-service_preshutdown_info)
107+
事件,对应节点将不得不跑完上述[节点非体面关闭](#non-graceful-node-shutdown)的流程。
108+
109+
<!--
110+
In the case where the Windows graceful node shutdown feature is enabled, but the kubelet is not
111+
running as a Windows service, the kubelet will continue running instead of failing. However,
112+
it will log an error indicating that it needs to be run as a Windows service.
113+
-->
114+
在启用 Windows 节点体面关闭特性但 kubelet 未作为 Windows 服务运行的情况下,kubelet 将继续运行而不会失败。
115+
但是,kubelet 将在日志中记录一个错误,表明它需要作为一个 Windows 服务来运行。
116+
{{% /tab %}}
117+
118+
{{< /tabs >}}
119+
120+
<!--
121+
### Configuring graceful node shutdown
122+
66123
Note that by default, both configuration options described below,
67124
`shutdownGracePeriod` and `shutdownGracePeriodCriticalPods`, are set to zero,
68125
thus not activating the graceful node shutdown functionality.
69126
To activate the feature, both options should be configured appropriately and
70127
set to non-zero values.
71128
-->
129+
## 配置节点体面关闭
130+
72131
注意,默认情况下,下面描述的两个配置选项,`shutdownGracePeriod`
73132
`shutdownGracePeriodCriticalPods` 都是被设置为 0 的,因此不会激活节点体面关闭特性。
74133
要激活此功能特性,这两个选项要适当配置,并设置为非零值。
75134

76135
<!--
77-
Once systemd detects or is notified of a node shutdown, the kubelet sets a `NotReady` condition on
136+
Once the kubelet is notified of a node shutdown, it sets a `NotReady` condition on
78137
the Node, with the `reason` set to `"node is shutting down"`. The kube-scheduler honors this condition
79138
and does not schedule any Pods onto the affected node; other third-party schedulers are
80139
expected to follow the same logic. This means that new Pods won't be scheduled onto that node
81140
and therefore none will start.
82141
-->
83-
一旦 systemd 检测到或收到节点关闭的通知,kubelet 就会在节点上设置一个
142+
一旦 kubelet 收到节点关闭的通知,就会在节点上设置一个
84143
`NotReady` 状况,并将 `reason` 设置为 `"node is shutting down"`
85144
kube-scheduler 会重视此状况,不将 Pod 调度到受影响的节点上;
86145
其他第三方调度程序也应当遵循相同的逻辑。这意味着新的 Pod 不会被调度到该节点上,
@@ -477,7 +536,7 @@ Kubernetes 将强制解除挂接正在被卸载的卷。
477536
The forced storage detach behaviour is optional; users might opt to use the "Non-graceful
478537
node shutdown" feature instead.
479538
-->
480-
强制存储解除挂接行为是可选的;用户可以选择使用"非体面节点关闭"特性。
539+
强制存储解除挂接行为是可选的;用户可以选择使用"节点非体面关闭"特性。
481540

482541
<!--
483542
Force storage detach on timeout can be disabled by setting the `disable-force-detach-on-timeout`
@@ -496,61 +555,17 @@ deleted.
496555
After this setting has been applied, unhealthy pods still attached to volumes must be recovered
497556
via the [Non-Graceful Node Shutdown](#non-graceful-node-shutdown) procedure mentioned above.
498557
-->
499-
应用此设置后,仍然关联卷到不健康 Pod 必须通过上述[非体面节点关闭](#non-graceful-node-shutdown)过程进行恢复。
558+
应用此设置后,仍然关联卷到不健康 Pod 必须通过上述[节点非体面关闭](#non-graceful-node-shutdown)过程进行恢复。
500559

501560
{{< note >}}
502561
<!--
503562
- Caution must be taken while using the [Non-Graceful Node Shutdown](#non-graceful-node-shutdown) procedure.
504563
- Deviation from the steps documented above can result in data corruption.
505564
-->
506-
- 使用[非体面节点关闭](#non-graceful-node-shutdown)过程时必须小心。
565+
- 使用[节点非体面关闭](#non-graceful-node-shutdown)过程时必须小心。
507566
- 偏离上述步骤可能会导致数据损坏。
508567
{{< /note >}}
509568

510-
<!--
511-
## Windows Graceful node shutdown {#windows-graceful-node-shutdown}
512-
-->
513-
## Windows 体面节点关闭 {#windows-graceful-node-shutdown}
514-
515-
{{< feature-state feature_gate_name="WindowsGracefulNodeShutdown" >}}
516-
517-
<!--
518-
The Windows graceful node shutdown feature depends on kubelet running as a Windows service,
519-
it will then have a registered [service control handler](https://learn.microsoft.com/en-us/windows/win32/services/service-control-handler-function)
520-
to delay the preshutdown event with a given duration.
521-
-->
522-
此服务会使用一个注册的[服务控制处理程序函数](https://learn.microsoft.com/zh-cn/windows/win32/services/service-control-handler-function)将
523-
preshutdown 事件延迟一段时间。
524-
525-
<!--
526-
Windows graceful node shutdown is controlled with the `WindowsGracefulNodeShutdown`
527-
[feature gate](/docs/reference/command-line-tools-reference/feature-gates/)
528-
which is introduced in 1.32 as an alpha feature.
529-
530-
Windows graceful node shutdown can not be cancelled.
531-
-->
532-
Windows 体面节点关闭是通过 1.32 中作为 Alpha 特性所引入的 `WindowsGracefulNodeShutdown`
533-
[特性门控](/zh-cn/docs/reference/command-line-tools-reference/feature-gates/)进行控制的。
534-
535-
Windows 体面节点关闭无法被取消。
536-
537-
<!--
538-
If kubelet is not running as a Windows service, it will not be able to set and monitor
539-
the [Preshutdown](https://learn.microsoft.com/en-us/windows/win32/api/winsvc/ns-winsvc-service_preshutdown_info) event,
540-
the node will have to go through the [Non-Graceful Node Shutdown](#non-graceful-node-shutdown) procedure mentioned above.
541-
-->
542-
如果 kubelet 不是作为 Windows 服务运行,它将不能设置和监控
543-
[Preshutdown](https://learn.microsoft.com/zh-cn/windows/win32/api/winsvc/ns-winsvc-service_preshutdown_info)
544-
事件,对应节点将不得不跑完上述[非体面节点关闭](#non-graceful-node-shutdown)的流程。
545-
546-
<!--
547-
In the case where the Windows graceful node shutdown feature is enabled, but the kubelet is not
548-
running as a Windows service, the kubelet will continue running instead of failing. However,
549-
it will log an error indicating that it needs to be run as a Windows service.
550-
-->
551-
在启用 Windows 体面节点关闭特性但 kubelet 未作为 Windows 服务运行的情况下,kubelet 将继续运行而不会失败。
552-
但是,kubelet 将在日志中记录一个错误,表明它需要作为一个 Windows 服务来运行。
553-
554569
## {{% heading "whatsnext" %}}
555570

556571
<!--
@@ -561,5 +576,5 @@ Learn more about the following:
561576
-->
562577
了解更多以下信息:
563578

564-
- 博客:[非体面节点关闭](/zh-cn/blog/2023/08/16/kubernetes-1-28-non-graceful-node-shutdown-ga/)。
579+
- 博客:[节点非体面关闭](/zh-cn/blog/2023/08/16/kubernetes-1-28-non-graceful-node-shutdown-ga/)。
565580
- 集群架构:[节点](/zh-cn/docs/concepts/architecture/nodes/)。

0 commit comments

Comments
 (0)