How do you remove the deploymentConfig, image streams, etc using Openshift OC?

ThatOneCoder picture ThatOneCoder · Aug 12, 2016 · Viewed 11.9k times · Source

After creating a new app using oc new-app location/nameofapp, many things are created: a deploymentConfig, an imagestream, a service, etc. I know you can run oc delete <label>. I would like to know how to delete all of these given the label.

Answer

Graham Dumpleton picture Graham Dumpleton · Aug 12, 2016

When using oc new-app, it would normally add a label on each resource created call app with value being the name given to the application. That name would be based on the name of the git repository, or could have been supplied using the --name option. Knowing that to delete everything you can then run:

oc delete all --selector app=appname

Before you delete anything you should be able to check what would matche by running:

oc get all --selector app=appname

Note that if creating from a template, rather than a repository, how things are labelled can depend on what the template itself sets up, so the instructions above may not apply.