Created
August 29, 2022 17:03
-
-
Save chalisekrishna418/c4792d4f8a5518874d8f34f594fbc8b6 to your computer and use it in GitHub Desktop.
Terminate Evicted Pods
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
NAMESPACES=$(kubectl get pods -A | grep Evicted | cut -f1 -d " " | uniq) | |
for NS in $NAMESPACES | |
do | |
PODS=$(kubectl get pods -n $NS | grep Evicted | cut -f1 -d " ") | |
i=0 | |
for POD in "$PODS" | |
do | |
kubectl delete pods -n $NS $POD | |
((i=i+1)) | |
echo "+++++++Deleted $i pods +++++++" | |
done | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment