Managed Kubernetes
Latest
Frequently Asked Questions
Solutions
How Tos
Internal Only
Templates
Powered By

Title
Message
Create new category
What is the title of your new category?
Edit page index title
What is the title of the page index?
Edit category
What is the new title of your category?
Edit link
What is the new title and URL of your link?
How to Enable Graceful Node Shutdown?
Copy Markdown
Open in ChatGPT
Open in Claude
Problem
- How to Enable Graceful Node Shutdown in a PMK cluster?
Environment
- Platform9 Managed Kubernetes - v5.2 Onward
- Kubernetes - v1.20 and Above
Procedure
- For enabling Graceful Node Shutdown feature, there are changes that needs to be made to the node's Kubelet configuration.
- For a cluster with Kubernetes version 1.20, it is required to explicitly enable the
GracefulNodeShutdownfeature under the featureGates (as it is a alpha feature). For Kubernetes v1.21 onward, it is enabled by default (as it is a beta feature). - To enable the
GracefulNodeShutdownunder the featureGates, edit the required master/workerconfigmap. Along with the feature gate, there is a requirement to set valuesShutdownGracePeriod&ShutdownGracePeriodCriticalPods(by default are set to zero).
In order for this to happen safely without any intervention from other services which keeps track of the status of the pf9-kubelet service, first stop the pf9-hostagent & pf9-nodeletd services on ALL the worker/master nodes depending on which configmap is being edited.
xxxxxxxxxxsudo systemctl stop pf9-{hostagent,nodeletd}- There are 2 different
default-kubelet-configconfigmaps under the namespacekube-system, one for master nodesmaster-default-kubelet-configand other for worker nodesworker-default-kubelet-config. - Edit appropriate configmap according to the requirement. e.g. in this case we are changing the worker configmap.
Enable GracefulNodeShutdown under the featureGates
xxxxxxxxxx# kubectl edit configmap worker-default-kubelet-config -n kube-systemconfigmap/worker-default-kubelet-config editedExample
xxxxxxxxxx# kubectl get configmap worker-default-kubelet-config -n kube-system -o yamlapiVersion: v1data:kubelet: |apiVersion: kubelet.config.k8s.io/v1beta1kind: KubeletConfiguration... featureGates: DynamicKubeletConfig: true GracefulNodeShutdown: true maxPods: 200 shutdownGracePeriod: 30s shutdownGracePeriodCriticalPods: 10s- Start the pf9-hostagent service on all the worker/master nodes where the service was stopped initially. This will eventually start the pf9-nodeletd service.
Command
xxxxxxxxxxsudo systemctl start pf9-hostagent- Verify if the GracefulNodeShutdown feature has been enabled or not from the worker node post editing the configmap.
Example
# less /var/log/pf9/kubelet/kubelet.INFO | grep "feature gates"I1208 22:01:52.214565 22305 feature_gate.go:243] feature gates: &{map[]}I1208 22:01:52.217698 22305 feature_gate.go:243] feature gates: &{map[DynamicKubeletConfig:true]}I1208 22:01:52.217779 22305 feature_gate.go:243] feature gates: &{map[DynamicKubeletConfig:true]}I1208 22:01:52.220247 22305 feature_gate.go:243] feature gates: &{map[DynamicKubeletConfig:true GracefulNodeShutdown:true]}I1208 22:01:52.220355 22305 feature_gate.go:243] feature gates: &{map[DynamicKubeletConfig:true GracefulNodeShutdown:true]}I1208 22:01:52.243430 22305 feature_gate.go:243] feature gates: &{map[DynamicKubeletConfig:true GracefulNodeShutdown:true]}I1208 22:01:52.243550 22305 feature_gate.go:243] feature gates: &{map[DynamicKubeletConfig:true GracefulNodeShutdown:true]}Verifying Enablement of GracefulNodeShutdown from Worker Node
xxxxxxxxxx[root@worker01 ~]# systemd-inhibit --listWho: kubelet (UID 0/root, PID 22305/kubelet)What: shutdownWhy: Kubelet needs time to handle node shutdownMode: delay 1 inhibitors listed.Additional Information
VariableType to search · ESC to discard
GlossaryType to search · ESC to discard
InsertType to search · ESC to discard
No matches
Last updated on
Was this page helpful?
Discard Changes
Do you want to discard your current changes and overwrite with the template?
Archive Synced Block
Message
Create new Template
What is this template's title?
Delete Template
Message