Skip to content

Commit e49f2ca

Browse files
committed
Update based on feedback
* Change ready status to false during node shutdown * Add note about new KubeletConfig option, `ShutdownGracePeriodCriticalPods`, to configure shutdown gracePeriod for critical pods * Update status to implementable
1 parent 2fb4744 commit e49f2ca

File tree

2 files changed

+25
-11
lines changed

2 files changed

+25
-11
lines changed

keps/sig-node/2000-graceful-node-shutdown/README.md

Lines changed: 24 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -364,23 +364,26 @@ classes](https://kubernetes.io/docs/tasks/administer-cluster/guaranteed-scheduli
364364

365365
Upon 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

372375
Kubelet will use the same existing
373376
[killPod](https://github.com/kubernetes/kubernetes/blob/release-1.19/pkg/kubelet/pod_workers.go#L292)
374377
function to perform the termination of pods, using `gracePeriodOverride` to set
375378
the appropriate grace period. During the termination process, normal [pod
376379
termination](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
378381
delivered, 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

385388
POC: 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 successful, we plan to add a debugging log statement just
420+
prior to kubelet's shutdown process being completed, so it's possible
421+
to verify 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
440446
to specify total time period kubelet should delay shutdown by and thus total time
441447
allocated 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
```
444457
type KubeletConfiguration struct {
445458
...
446459
ShutdownGracePeriod metav1.Duration
460+
ShutdownGracePeriodCriticalPods metav1.Duration
447461
}
448462
```
449463

keps/sig-node/2000-graceful-node-shutdown/kep.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ authors:
44
- "bobbypage"
55
- "mrunalp"
66
owning-sig: sig-node
7-
status: provisional
7+
status: implementable
88
creation-date: 2020-09-21
99

1010
# The target maturity stage in the current dev cycle for this KEP.

0 commit comments

Comments
 (0)