Skip to content

Commit 141e688

Browse files
Enable graceful node shutdown for 1.29+
1 parent 82ec420 commit 141e688

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

templates/al2/provisioners/install-worker.sh

+7
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,13 @@ fi
136136

137137
sudo mv "${WORKING_DIR}/runtime.slice" /etc/systemd/system/runtime.slice
138138

139+
if vercmp "$KUBELET_VERSION" gteq "1.30.0"; then
140+
# increase the max inhibit delay to accomodate kubelet's graceful shutdown procedure
141+
cat << EOF | sudo tee /etc/systemd/logind.conf.d/00-kubelet-graceful-shutdown.conf
142+
InhibitDelayMaxSec=45
143+
EOF
144+
fi
145+
139146
###############################################################################
140147
### Containerd setup ##########################################################
141148
###############################################################################

templates/al2/runtime/bootstrap.sh

+5
Original file line numberDiff line numberDiff line change
@@ -482,6 +482,11 @@ fi
482482
KUBELET_CONFIG=/etc/kubernetes/kubelet/kubelet-config.json
483483
echo $(jq --arg DNS_CLUSTER_IP "$DNS_CLUSTER_IP" '.clusterDNS=($DNS_CLUSTER_IP|split(","))' $KUBELET_CONFIG) > $KUBELET_CONFIG
484484

485+
if vercmp "$KUBELET_VERSION" gteq "1.30.0"; then
486+
echo "$(jq ".shutdownGracePeriod=\"45s\"" $KUBELET_CONFIG)" > $KUBELET_CONFIG
487+
echo "$(jq ".shutdownGracePeriodCriticalPods=\"15s\"" $KUBELET_CONFIG)" > $KUBELET_CONFIG
488+
fi
489+
485490
if [[ "${IP_FAMILY}" == "ipv4" ]]; then
486491
INTERNAL_IP=$(imds 'latest/meta-data/local-ipv4')
487492
else

0 commit comments

Comments
 (0)