Sometimes you need to delete all pods in a cluster using the kubectl utility.
This script will delete all pods that are not in the Running state — such as Terminating and Pending pods.
kubectl get pods -A | grep -E "Terminating|Pending" | awk '{print $1, $2}' | while read ns pod; do kubectl delete pod $pod -n $ns --force --grace-period=0; done