Skip to content

Instantly share code, notes, and snippets.

@palonsoro
Created June 11, 2019 10:51
Show Gist options
  • Save palonsoro/7ea0caa65ff534fccd4e19b0b5c5655d to your computer and use it in GitHub Desktop.
Save palonsoro/7ea0caa65ff534fccd4e19b0b5c5655d to your computer and use it in GitHub Desktop.
Delete all the failed pods on an OpenShift cluster
#!/bin/bash
oc get pod -o wide --all-namespaces --field-selector=status.phase=Failed -o template --template '{{range .items}}-n {{.metadata.namespace}} {{.metadata.name}}{{"\n"}}{{end}}' | xargs -n3 oc delete pod
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment