@@ -28,12 +28,10 @@ either **graceful** or **non-graceful**.
28
28
-->
29
29
## 节点体面关闭 {#graceful-node-shutdown}
30
30
31
- {{< feature-state feature_gate_name="GracefulNodeShutdown" >}}
32
-
33
31
<!--
34
32
The kubelet attempts to detect node system shutdown and terminates pods running on the node.
35
33
36
- kubelet ensures that pods follow the normal
34
+ Kubelet ensures that pods follow the normal
37
35
[pod termination process](/docs/concepts/workloads/pods/pod-lifecycle/#pod-termination)
38
36
during the node shutdown. During node shutdown, the kubelet does not accept new
39
37
Pods (even if those Pods are already bound to the node).
@@ -44,43 +42,104 @@ kubelet 会尝试检测节点系统关闭事件并终止在节点上运行的所
44
42
[ Pod 终止流程] ( /zh-cn/docs/concepts/workloads/pods/pod-lifecycle/#pod-termination ) ,
45
43
且不接受新的 Pod(即使这些 Pod 已经绑定到该节点)。
46
44
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
+ <!--
48
65
The graceful node shutdown feature depends on systemd since it takes advantage of
49
66
[systemd inhibitor locks](https://www.freedesktop.org/wiki/Software/systemd/inhibit/) to
50
67
delay the node shutdown with a given duration.
51
68
-->
52
69
节点体面关闭特性依赖于 systemd,因为它要利用
53
70
[ systemd 抑制器锁] ( https://www.freedesktop.org/wiki/Software/systemd/inhibit/ ) 机制,
54
71
在给定的期限内延迟节点关闭。
72
+ {{</ note >}}
73
+ {{% /tab %}}
74
+
75
+ {{% tab name="Windows" %}}
76
+ {{< feature-state feature_gate_name="WindowsGracefulNodeShutdown" >}}
55
77
56
78
<!--
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.
60
83
-->
61
- 节点体面关闭特性受 ` GracefulNodeShutdown `
84
+ 在 Windows 上, 节点体面关闭特性受 ` WindowsGracefulNodeShutdown `
62
85
[ 特性门控] ( /zh-cn/docs/reference/command-line-tools-reference/feature-gates/ ) 控制,
63
- 在 1.21 版本中是默认启用的 。
86
+ 此特性在 1.32 版本中作为 Alpha 特性引入, 在 1.34 版本中变为 Beta 并且默认启用 。
64
87
65
88
<!--
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
+
66
123
Note that by default, both configuration options described below,
67
124
`shutdownGracePeriod` and `shutdownGracePeriodCriticalPods`, are set to zero,
68
125
thus not activating the graceful node shutdown functionality.
69
126
To activate the feature, both options should be configured appropriately and
70
127
set to non-zero values.
71
128
-->
129
+ ## 配置节点体面关闭
130
+
72
131
注意,默认情况下,下面描述的两个配置选项,` shutdownGracePeriod ` 和
73
132
` shutdownGracePeriodCriticalPods ` 都是被设置为 0 的,因此不会激活节点体面关闭特性。
74
133
要激活此功能特性,这两个选项要适当配置,并设置为非零值。
75
134
76
135
<!--
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
78
137
the Node, with the `reason` set to `"node is shutting down"`. The kube-scheduler honors this condition
79
138
and does not schedule any Pods onto the affected node; other third-party schedulers are
80
139
expected to follow the same logic. This means that new Pods won't be scheduled onto that node
81
140
and therefore none will start.
82
141
-->
83
- 一旦 systemd 检测到或收到节点关闭的通知, kubelet 就会在节点上设置一个
142
+ 一旦 kubelet 收到节点关闭的通知, 就会在节点上设置一个
84
143
` NotReady ` 状况,并将 ` reason ` 设置为 ` "node is shutting down" ` 。
85
144
kube-scheduler 会重视此状况,不将 Pod 调度到受影响的节点上;
86
145
其他第三方调度程序也应当遵循相同的逻辑。这意味着新的 Pod 不会被调度到该节点上,
@@ -477,7 +536,7 @@ Kubernetes 将强制解除挂接正在被卸载的卷。
477
536
The forced storage detach behaviour is optional; users might opt to use the "Non-graceful
478
537
node shutdown" feature instead.
479
538
-->
480
- 强制存储解除挂接行为是可选的;用户可以选择使用"非体面节点关闭 "特性。
539
+ 强制存储解除挂接行为是可选的;用户可以选择使用"节点非体面关闭 "特性。
481
540
482
541
<!--
483
542
Force storage detach on timeout can be disabled by setting the `disable-force-detach-on-timeout`
@@ -496,61 +555,17 @@ deleted.
496
555
After this setting has been applied, unhealthy pods still attached to volumes must be recovered
497
556
via the [Non-Graceful Node Shutdown](#non-graceful-node-shutdown) procedure mentioned above.
498
557
-->
499
- 应用此设置后,仍然关联卷到不健康 Pod 必须通过上述[非体面节点关闭 ](#non-graceful-node-shutdown)过程进行恢复。
558
+ 应用此设置后,仍然关联卷到不健康 Pod 必须通过上述[节点非体面关闭 ](#non-graceful-node-shutdown)过程进行恢复。
500
559
501
560
{{< note >}}
502
561
<!--
503
562
- Caution must be taken while using the [Non-Graceful Node Shutdown](#non-graceful-node-shutdown) procedure.
504
563
- Deviation from the steps documented above can result in data corruption.
505
564
-->
506
- - 使用[非体面节点关闭 ](#non-graceful-node-shutdown)过程时必须小心。
565
+ - 使用[节点非体面关闭 ](#non-graceful-node-shutdown)过程时必须小心。
507
566
- 偏离上述步骤可能会导致数据损坏。
508
567
{{< /note >}}
509
568
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
-
554
569
# # {{% heading "whatsnext" %}}
555
570
556
571
<!--
@@ -561,5 +576,5 @@ Learn more about the following:
561
576
-->
562
577
了解更多以下信息:
563
578
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/)。
565
580
- 集群架构:[节点](/zh-cn/docs/concepts/architecture/nodes/)。
0 commit comments