Skip to content

Instantly share code, notes, and snippets.

@freyes
Created December 17, 2024 19:12
Show Gist options
  • Save freyes/0f4cf317b67e12e487f89471d915b2b8 to your computer and use it in GitHub Desktop.
Save freyes/0f4cf317b67e12e487f89471d915b2b8 to your computer and use it in GitHub Desktop.
n an emergency that requires freeing resources in one specific node
#!/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