Created
December 14, 2018 15:26
-
-
Save emakarov/83b883963be542ebafaed19d9faa4ba4 to your computer and use it in GitHub Desktop.
How to delete all kubernetes pods by mask from bash command 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
kubectl get pods | grep enter_your_mask_here | while read line ; do echo "$line" | awk '{print $1}' | sort | while read line2; do kubectl delete pod "$line2" ; done; done |
Evicted:
kubectl get pods | grep Evicted | while read line ; do echo "$line" | awk '{print $1}' | sort | while read line2; do kubectl delete pod "$line2" ; done; done
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
If you need to delete all kubernetes pods by specific mask, use command above