Skip to content

Instantly share code, notes, and snippets.

@owainlewis
Created February 13, 2018 12:17
Show Gist options
  • Save owainlewis/77b241a0063ddf4a9541b71323b07bc0 to your computer and use it in GitHub Desktop.
Save owainlewis/77b241a0063ddf4a9541b71323b07bc0 to your computer and use it in GitHub Desktop.
Delete all non running Kubernetes pods
kubectl get pods -a | grep -v Running | awk '{print $1}' | xargs kubectl delete pod
@Jyny
Copy link

Jyny commented Jun 29, 2020

without -a is work

@tommyjcarpenter
Copy link

-a is not a legal flag

@mitchellhuang
Copy link

mitchellhuang commented Jun 10, 2021

kubectl get pods --no-headers | grep -v Running | awk '{print $2}' | xargs kubectl delete pod

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment