During a graceful node shutdown, the kubelet sends a termination signal to pods running on the node and postpones the node shutdown until all the pods evicted. If a node unexpectedly shuts down, the graceful node shutdown feature minimizes interruption to workloads running on these pods.
During a graceful node shutdown, the kubelet stops pods in two phases:
-
Regular pod termination
-
Critical pod termination
You can define shutdown grace periods for regular and critical pods by configuring the following specifications in the KubeletConfig
custom resource:
-
shutdownGracePeriod
: Specifies the total duration for pod termination for regular and critical pods.
-
shutdownGracePeriodCriticalPods
: Specifies the duration for critical pod termination. This value must be less than the shutdownGracePeriod
value.
For example, if the shutdownGracePeriod
value is 30s
, and the shutdownGracePeriodCriticalPods
value is 10s
, the kubelet delays the node shutdown by 30 seconds. During the shutdown, the first 20 (30-10) seconds are reserved for gracefully shutting down regular pods, and the last 10 seconds are reserved for gracefully shutting down critical pods.
To define a critical pod, assign a pod priority value greater than or equal to 2000000000
. To define a regular pod, assign a pod priority value of less than 2000000000
.
For more information about how to define a priority value for pods, see the Additional resources section.