@@ -16,30 +16,66 @@ either **graceful** or **non-graceful**.
16
16
17
17
## Graceful node shutdown {#graceful-node-shutdown}
18
18
19
- {{< feature-state feature_gate_name="GracefulNodeShutdown" >}}
20
-
21
19
The kubelet attempts to detect node system shutdown and terminates pods running on the node.
22
20
23
- kubelet ensures that pods follow the normal
21
+ Kubelet ensures that pods follow the normal
24
22
[ pod termination process] ( /docs/concepts/workloads/pods/pod-lifecycle/#pod-termination )
25
23
during the node shutdown. During node shutdown, the kubelet does not accept new
26
24
Pods (even if those Pods are already bound to the node).
27
25
26
+ ### Enabling graceful node shutdown
27
+
28
+ {{< tabs name="graceful_shutdown_os" >}}
29
+ {{% tab name="Linux" %}}
30
+ {{< feature-state feature_gate_name="GracefulNodeShutdown" >}}
31
+
32
+ On Linux, the graceful node shutdown feature is controlled with the ` GracefulNodeShutdown `
33
+ [ feature gate] ( /docs/reference/command-line-tools-reference/feature-gates/ ) which is
34
+ enabled by default in 1.21.
35
+
36
+ {{< note >}}
28
37
The graceful node shutdown feature depends on systemd since it takes advantage of
29
38
[ systemd inhibitor locks] ( https://www.freedesktop.org/wiki/Software/systemd/inhibit/ ) to
30
39
delay the node shutdown with a given duration.
40
+ {{</ note >}}
41
+ {{% /tab %}}
31
42
32
- Graceful node shutdown is controlled with the ` GracefulNodeShutdown `
33
- [ feature gate] ( /docs/reference/command-line-tools-reference/feature-gates/ ) which is
34
- enabled by default in 1.21.
43
+ {{% tab name="Windows" %}}
44
+ {{< feature-state feature_gate_name="WindowsGracefulNodeShutdown" >}}
45
+
46
+ On Windows, the graceful node shutdown feature is controlled with the ` WindowsGracefulNodeShutdown `
47
+ [ feature gate] ( /docs/reference/command-line-tools-reference/feature-gates/ )
48
+ which is introduced in 1.32 as an alpha feature. In Kubernetes 1.34 the feature is Beta
49
+ and is enabled by default.
50
+
51
+ {{< note >}}
52
+ The Windows graceful node shutdown feature depends on kubelet running as a Windows service,
53
+ it will then have a registered [ service control handler] ( https://learn.microsoft.com/en-us/windows/win32/services/service-control-handler-function )
54
+ to delay the preshutdown event with a given duration.
55
+ {{</ note >}}
56
+
57
+ Windows graceful node shutdown can not be cancelled.
58
+
59
+ If kubelet is not running as a Windows service, it will not be able to set and monitor
60
+ the [ Preshutdown] ( https://learn.microsoft.com/en-us/windows/win32/api/winsvc/ns-winsvc-service_preshutdown_info ) event,
61
+ the node will have to go through the [ Non-Graceful Node Shutdown] ( #non-graceful-node-shutdown ) procedure mentioned above.
62
+
63
+ In the case where the Windows graceful node shutdown feature is enabled, but the kubelet is not
64
+ running as a Windows service, the kubelet will continue running instead of failing. However,
65
+ it will log an error indicating that it needs to be run as a Windows service.
66
+ {{% /tab %}}
67
+
68
+ {{< /tabs >}}
69
+
70
+ ### Configuring graceful node shutdown
35
71
36
72
Note that by default, both configuration options described below,
37
73
` shutdownGracePeriod ` and ` shutdownGracePeriodCriticalPods ` , are set to zero,
38
74
thus not activating the graceful node shutdown functionality.
39
75
To activate the feature, both options should be configured appropriately and
40
76
set to non-zero values.
41
77
42
- Once systemd detects or is notified of a node shutdown, the kubelet sets a ` NotReady ` condition on
78
+ Once the kubelet is notified of a node shutdown, it sets a ` NotReady ` condition on
43
79
the Node, with the ` reason ` set to ` "node is shutting down" ` . The kube-scheduler honors this condition
44
80
and does not schedule any Pods onto the affected node; other third-party schedulers are
45
81
expected to follow the same logic. This means that new Pods won't be scheduled onto that node
@@ -273,29 +309,6 @@ via the [Non-Graceful Node Shutdown](#non-graceful-node-shutdown) procedure ment
273
309
274
310
{{< /note >}}
275
311
276
- # # Windows Graceful node shutdown {#windows-graceful-node-shutdown}
277
-
278
- {{< feature-state feature_gate_name="WindowsGracefulNodeShutdown" >}}
279
-
280
- The Windows graceful node shutdown feature depends on kubelet running as a Windows service,
281
- it will then have a registered [service control handler](https://learn.microsoft.com/en-us/windows/win32/services/service-control-handler-function)
282
- to delay the preshutdown event with a given duration.
283
-
284
- Windows graceful node shutdown is controlled with the `WindowsGracefulNodeShutdown`
285
- [feature gate](/docs/reference/command-line-tools-reference/feature-gates/)
286
- which is introduced in 1.32 as an alpha feature. In Kubernetes 1.34 the feature is Beta
287
- and is enabled by default.
288
-
289
- Windows graceful node shutdown can not be cancelled.
290
-
291
- If kubelet is not running as a Windows service, it will not be able to set and monitor
292
- the [Preshutdown](https://learn.microsoft.com/en-us/windows/win32/api/winsvc/ns-winsvc-service_preshutdown_info) event,
293
- the node will have to go through the [Non-Graceful Node Shutdown](#non-graceful-node-shutdown) procedure mentioned above.
294
-
295
- In the case where the Windows graceful node shutdown feature is enabled, but the kubelet is not
296
- running as a Windows service, the kubelet will continue running instead of failing. However,
297
- it will log an error indicating that it needs to be run as a Windows service.
298
-
299
312
# # {{% heading "whatsnext" %}}
300
313
301
314
Learn more about the following :
0 commit comments