OpenShift - Delete deployment using the oc delete deployment command

An image contains the code used to create a deployment. Then, a deployment can be created from an image, which should then create a replica set (which is the number of pods that should be created), and then the pods should be created.

If you are not familiar with the oc command, refer to OpenShift - Getting Started with the oc command.

The oc get deployments command can be used to list the deployments in a project / namespace. Let's say you want to undeploy my-app-v1.

~]# oc get deployments
NAME        READY   UP-TO-DATE   AVAILABLE   AGE
my-app-v1   1/1     1            1           8d
my-app-v2   1/1     1            1           8d

 

The oc delete deployment command can be used to delete a deployment.

~]# oc delete deployment my-app-v1
deployment.apps "my-app-v1" deleted

 

The oc get events command should show the pod being killed.

~]$ oc get events
LAST SEEN   TYPE     REASON    OBJECT                                               MESSAGE
39s         Normal   Killing   pod/my-app-v1-lcgsf   Stopping container my-app

 

After the deployment has been deleted, you may want to use the oc get all command to see if there are any other resources in the project / namespace that should be removed, such as a service or route.

~]$ oc get all
NAME                       TYPE        CLUSTER-IP       EXTERNAL-IP   PORT(S)   AGE
service/my-service         ClusterIP   172.30.164.121   <none>        27017/TCP   114d

NAME          HOST/PORT                PATH                     SERVICES     PORT     TERMINATION          WILDCARD
route.route.openshift.io/my-route      example.com              service001   8080     reencrypt/Redirect   None

 




Did you find this article helpful?

If so, consider buying me a coffee over at Buy Me A Coffee

Add a Comment




We will never share your name or email with anyone. Enter your email if you would like to be notified when we respond to your comment.





Please enter 4ca73 in the box below so that we can be sure you are a human.




Comments

Web design by yours truely - me, myself, and I   |   jeremy.canfield@freekb.net   |