Created
December 17, 2024 19:12
-
-
Save freyes/0f4cf317b67e12e487f89471d915b2b8 to your computer and use it in GitHub Desktop.
n an emergency that requires freeing resources in one specific node
This file contains hidden or 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
#!/bin/bash | |
# source: https://stackoverflow.com/a/78983037 | |
# In an emergency that requires freeing resources in one specific node, use this: | |
export OVERLOADED_NODE=worker-09 | |
export DEPLOYMENT_TO_MOVE=myapp | |
kubectl top nodes | |
kubectl taint nodes ${OVERLOADED_NODE} tmp=tmp:NoSchedule | |
kubectl rollout restart deployment ${DEPLOYMENT_TO_MOVE} | |
kubectl rollout status deployment ${DEPLOYMENT_TO_MOVE} | |
kubectl taint nodes ${OVERLOADED_NODE} tmp=tmp:NoSchedule- | |
sleep 20 #wait some seconds for the metrics update | |
kubectl top nodes | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment