Skip to content

Instantly share code, notes, and snippets.

@clayrisser
Created May 22, 2024 09:05
Show Gist options
  • Save clayrisser/f5ac8cf9185cc737a28042791655a2dc to your computer and use it in GitHub Desktop.
Save clayrisser/f5ac8cf9185cc737a28042791655a2dc to your computer and use it in GitHub Desktop.
Delete all pods with phase Error
kubectl get pods --all-namespaces -o custom-columns=NAMESPACE:.metadata.namespace,NAME:.metadata.name,REASON:.status.phase --field-selector=status.phase=Failed --no-headers | awk '{print $1 " " $2}' | while read ns pod; do echo kubectl delete pod $pod -n $ns
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment