@@ -364,23 +364,26 @@ classes](https://kubernetes.io/docs/tasks/administer-cluster/guaranteed-scheduli
364364
365365Upon shutdown Kubelet will:
366366
367- 1 . Gracefully terminate all non critical system pods with a gracePeriodOverride
368- computed as ` min(podSpec.terminationGracePeriodSeconds, ShutdownGracePeriod) `
369- 2 . Gracefully terminate all critical system pods with gracePeriodOverride of 2
370- seconds
367+ 1 . Update the Node's ` Ready ` condition to ` false ` , with the reason `Node is
368+ shutting down`
369+ 2 . Gracefully terminate all non critical system pods with a gracePeriodOverride
370+ computed as `min(podSpec.terminationGracePeriodSeconds,
371+ ShutdownGracePeriod-ShutdownGracePeriodCriticalPods)`
372+ 3 . Gracefully terminate all critical system pods with gracePeriodOverride of
373+ ` ShutdownGracePeriodCriticalPods ` seconds
371374
372375Kubelet will use the same existing
373376[ killPod] ( https://github.com/kubernetes/kubernetes/blob/release-1.19/pkg/kubelet/pod_workers.go#L292 )
374377function to perform the termination of pods, using ` gracePeriodOverride ` to set
375378the appropriate grace period. During the termination process, normal [ pod
376379termination] ( https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle/#pod-termination )
377- processes will apply, e.g. preStopHooks will be called, SIGTERM to containers
380+ processes will apply, e.g. preStop Hooks will be called, ` SIGTERM ` to containers
378381delivered, etc.
379382
380- 2 seconds as gracePeriodOverride for critical system pods was decided to ensure
381- that they can also perform a graceful shutdown and 2 seconds is currently
382- [ defined ] ( https://github.com/kubernetes/kubernetes/blob/release-1.19/pkg/kubelet/kuberuntime/kuberuntime_container.go#L626-L629 )
383- as the minimum grace period defined in the kubelet .
383+ To ensure ` gracePeriodOverride ` is respected, Github issue
384+ [ # 92432 ] ( https://github.com/kubernetes/kubernetes/issues/92432 ) should also be
385+ addressed to ensure that ` gracePeriod ` override will be respected for ` preStop `
386+ hooks .
384387
385388POC: I’ve prototyped an initial POC
386389[ here] ( https://github.com/bobbypage/kubernetes/tree/shutdown ) of the proposed
@@ -412,7 +415,10 @@ Consider including folks who also work outside the SIG or subproject.
412415
413416* Kubelet does not receive shutdown event or is able to create inhibitor lock
414417 * Mitigation: Kubelet does not provide graceful shutdown to pods (same as
415- today’s existing behavior)
418+ today’s existing behavior). For alpha stage, to track shutdown behavior
419+ and if it was succesful, we plan to add a debugging log statement just prior to
420+ kubelet's shutdown process being completed, so it's possible to verify
421+ if kubelet shutdown the node gracefully.
416422* Kubelet is unable to update ` InhibitDelayMaxSec ` in logind to match that of
417423 ` kubeletConfig.ShutdownGracePeriod `
418424 * If there are multiple logind configuration file overrides in
@@ -440,10 +446,18 @@ The design proposes adding a new KubeletConfig field `ShutdownGracePeriod` used
440446to specify total time period kubelet should delay shutdown by and thus total time
441447allocated to the graceful termination process.
442448
449+ In addition to ` ShutdownGracePeriod ` , another KubeletConfig field will be added
450+ ` ShutdownGracePeriodCriticalPods ` . During the shutdown, the
451+ ` ShutdownGracePeriod-ShutdownGracePeriodCriticalPods ` duration will be grace
452+ period for non critical system pods like user workloads, while the remaining
453+ time of ` ShutdownGracePeriodCriticalPods ` will be the grace period for critical
454+ pods like node logging daemonsets.
455+
443456```
444457type KubeletConfiguration struct {
445458 ...
446459 ShutdownGracePeriod metav1.Duration
460+ ShutdownGracePeriodCriticalPods metav1.Duration
447461}
448462```
449463
0 commit comments