Last active
November 12, 2020 19:27
-
-
Save superseb/0f654d4e8945195e08fd1a2a061e0762 to your computer and use it in GitHub Desktop.
Delete evicted pods kubectl
This file contains 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 characters
#!/bin/bash | |
kubectl get pods --all-namespaces -o go-template='{{range .items}}{{if eq .status.phase "Failed"}}{{if eq .status.reason "Evicted"}}{{.metadata.name}}{{" "}}{{.metadata.namespace}}{{"\n"}}{{end}}{{end}}{{end}}' | while read epod namespace; do kubectl -n $namespace delete pod $epod; done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment