Skip to content

Commit

Permalink
Enable graceful node shutdown for 1.29+
Browse files Browse the repository at this point in the history
  • Loading branch information
cartermckinnon committed Apr 9, 2024
1 parent 82ec420 commit 141e688
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
7 changes: 7 additions & 0 deletions templates/al2/provisioners/install-worker.sh
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,13 @@ fi

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

if vercmp "$KUBELET_VERSION" gteq "1.30.0"; then
# increase the max inhibit delay to accomodate kubelet's graceful shutdown procedure
cat << EOF | sudo tee /etc/systemd/logind.conf.d/00-kubelet-graceful-shutdown.conf
InhibitDelayMaxSec=45
EOF
fi

###############################################################################
### Containerd setup ##########################################################
###############################################################################
Expand Down
5 changes: 5 additions & 0 deletions templates/al2/runtime/bootstrap.sh
Original file line number Diff line number Diff line change
Expand Up @@ -482,6 +482,11 @@ fi
KUBELET_CONFIG=/etc/kubernetes/kubelet/kubelet-config.json
echo $(jq --arg DNS_CLUSTER_IP "$DNS_CLUSTER_IP" '.clusterDNS=($DNS_CLUSTER_IP|split(","))' $KUBELET_CONFIG) > $KUBELET_CONFIG

if vercmp "$KUBELET_VERSION" gteq "1.30.0"; then
echo "$(jq ".shutdownGracePeriod=\"45s\"" $KUBELET_CONFIG)" > $KUBELET_CONFIG
echo "$(jq ".shutdownGracePeriodCriticalPods=\"15s\"" $KUBELET_CONFIG)" > $KUBELET_CONFIG
fi

if [[ "${IP_FAMILY}" == "ipv4" ]]; then
INTERNAL_IP=$(imds 'latest/meta-data/local-ipv4')
else
Expand Down

0 comments on commit 141e688

Please sign in to comment.