Bootstrap FreeKB - OpenShift - Delete deployment using the oc delete deployment command
OpenShift - Delete deployment using the oc delete deployment command

Updated:   |  OpenShift articles

A deployment is used to manage the pods that are created to run an application. The deployment ensures that the desired number of pod replicas are running and can handle updates to the application by rolling out new versions of the pods. The deployment creates and manages a replica set, which in turn manages the pods.

flowchart TB subgraph Project["OpenShift Project/Namespace"] Deployment[Deployment] Replica_Set[Replica Set] subgraph Pods["Pod Replicas"] Pod1[Pod 1
Container] Pod2[Pod 2
Container] Pod3[Pod 3
Container] end end Deployment -->|Creates/Manages| Replica_Set Replica_Set -->|Manages| Pod1 Replica_Set -->|Manages| Pod2 Replica_Set -->|Manages| Pod3 style Deployment fill:#90CAF9 style Replica_Set fill:#FFE082 style Pods fill:#FFCCBC

It is also noteworthy that a route provides a URL that can be used to access the application from outside the OpenShift cluster. For example, if the route is configured to use the hostname myapp.mydomain.com, then users can access the application by navigating to http://myapp.mydomain.com. The route will forward the request to the service, which will then forward the request to one of the pods that are running the application.

flowchart LR subgraph Project["OpenShift Project/Namespace"] subgraph Pods["Pod Replicas"] Pod1[Pod 1
Container] Pod2[Pod 2
Container] Pod3[Pod 3
Container] end SVC[Service] Route[Route] end USER[External User] --> Route --> SVC SVC --> Pod1 SVC --> Pod2 SVC --> Pod3 style SVC fill:#A5D6A7 style Pods fill:#FFCCBC style USER fill:#CE93D8

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   10.11.12.13   <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



Comments


Add a Comment


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