Skip to content

Instantly share code, notes, and snippets.

@ikurni
Last active March 18, 2026 16:33
Show Gist options
  • Select an option

  • Save ikurni/3875e9c43861dd26a0b384e5e60479ef to your computer and use it in GitHub Desktop.

Select an option

Save ikurni/3875e9c43861dd26a0b384e5e60479ef to your computer and use it in GitHub Desktop.
OCP Command Cheatsheets
### Nested Loops
#for i in $(oc get project | grep -i -v '^openshift\| ^kube' | awk '{print $1}'); do for y in $(oc get pods -n $i | grep -i completed | awk '{print $1}'); do oc delete pods $y -n $i; done; done
### Force Delete all terminating pods in all Namespaces
#oc get pods -A | grep Terminating | awk '{print "oc delete pod " $2 " -n " $1 " --force --grace-period=0"}' | sh
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment