Forked from psxvoid/delete-evicted-pods-all-namespaces.sh
Created
August 7, 2019 07:53
-
-
Save rschumann/b8e341876f4f92f4015fe20050169f3b to your computer and use it in GitHub Desktop.
Revisions
-
psxvoid created this gist
Aug 6, 2018 .There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,11 @@ #!/bin/sh # based on https://gist.github.com/ipedrazas/9c622404fb41f2343a0db85b3821275d # delete all evicted pods from all namespaces kubectl get pods --all-namespaces | grep Evicted | awk '{print $2 " --namespace=" $1}' | xargs kubectl delete pod # delete all containers in ImagePullBackOff state from all namespaces kubectl get pods --all-namespaces | grep 'ImagePullBackOff' | awk '{print $2 " --namespace=" $1}' | xargs kubectl delete pod # delete all containers in ImagePullBackOff or ErrImagePull or Evicted state from all namespaces kubectl get pods --all-namespaces | grep -E 'ImagePullBackOff|ErrImagePull|Evicted' | awk '{print $2 " --namespace=" $1}' | xargs kubectl delete pod