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

Updated:   |  OpenShift articles

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

I like to think of a "machine" as OpenShift representation of a Virtual Machine, such as an Amazon Web Services (AWS) EC2 Instance, or a VMWare Virtual Machine, and then a Node, and then the pods running on the node.

 

The oc get machineset command can be used to display the cluster of edge, infra and worker machines. The machines will be in the openshift-machine-api namespace. Notice in this example that there are 2 worker machines.

~]$ oc get machineset --namespace openshift-machine-api
NAME            DESIRED   CURRENT   READY   AVAILABLE   AGE
lab001-edge     2         2         2       2           140d
lab001-infra    3         3         3       3           140d
lab001-worker   2         2         2       2           143d

 

The oc get machines command can be used to display the machines. Notice that the 2 worker machines are listed.

~]$ oc get machines --namespace openshift-machine-api 
NAME                  PHASE     TYPE   REGION   ZONE   AGE
lab001-edge-lm6wz     Running                          140d
lab001-edge-pmlls     Running                          140d
lab001-infra-c4v5h    Running                          140d
lab001-infra-mc8rc    Running                          140d
lab001-infra-p9cjv    Running                          140d
lab001-master-0       Running                          143d
lab001-master-1       Running                          143d
lab001-master-2       Running                          143d
lab001-worker-hsjrp   Running                          140d
lab001-worker-v8r9r   Running                          140d

 

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

~]$ oc delete machine lab001-worker-v8r9r --namespace openshift-machine-api
machine.machine.openshift.io "lab001-worker-v8r9r" deleted

 

This will reduce the CURRENT count to be less than the DESIRED count. 

A new machine should be automatically created to bring the CURRENT/READY/AVAILABLE count up to the DESIRED count.

~]$ oc get machineset --namespace openshift-machine-api
NAME            DESIRED   CURRENT   READY   AVAILABLE   AGE
lab001-edge     2         2         2       2           140d
lab001-infra    3         3         3       3           140d
lab001-worker   2         1         1       1           143d

 




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 d52c27 in the box below so that we can be sure you are a human.