Created
July 13, 2018 00:11
-
-
Save berndverst/66e7158126863514874a3aba024543f4 to your computer and use it in GitHub Desktop.
Restarting a AKS kubernetes node gracefully in one line
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
AKSNODE=aks-nodepool1-32072832-0; kubectl cordon $AKSNODE && kubectl drain $AKSNODE --ignore-daemonsets=true && echo "$AKSNODE restarting" && az vm restart -g MC_containergroupeast_managedkube_eastus -n $AKSNODE && sleep 10 && kubectl uncordon $AKSNODE && until [ $(kubectl get node $AKSNODE --output=json | jq -c '.status.conditions | map(select(.type == "Ready"))[0].status') = '"True"' ]; do echo "sleeping 10 seconds\n" && sleep 10; done && echo "$AKSNODE successfully restarted" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment