Skip to content

Instantly share code, notes, and snippets.

@babvin
Last active January 4, 2021 11:33
Show Gist options
  • Save babvin/cc43aa0cac44fc10ca138d4590a766b0 to your computer and use it in GitHub Desktop.
Save babvin/cc43aa0cac44fc10ca138d4590a766b0 to your computer and use it in GitHub Desktop.
Delete pods which are stuck at terminating
For one: kubectl delete pod <PODNAME> --grace-period=0 --force --namespace <NAMESPACE>
For Many: kubectl get pods --all-namespaces | grep Terminating | while read line; do
pod_name=$(echo $line | awk '{print $2}' ) name_space=$(echo $line | awk '{print $1}' ); kubectl delete pods $pod_name -n $name_space --grace-period=0 --force;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment