Skip to content

Instantly share code, notes, and snippets.

@emakarov
Created December 14, 2018 15:26
Show Gist options
  • Save emakarov/83b883963be542ebafaed19d9faa4ba4 to your computer and use it in GitHub Desktop.
Save emakarov/83b883963be542ebafaed19d9faa4ba4 to your computer and use it in GitHub Desktop.
How to delete all kubernetes pods by mask from bash command line
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
@emakarov
Copy link
Author

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