
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. Machine Configs can be used to configure the Virtual Machine Operating System, such as configuring a Linux systemd service such as sshd or chronyd or Network Manager.
The oc get machineset command can be used to display the desired, current, ready and available 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
my-cluster-edge 2 2 2 2 140d
my-cluster-infra 3 3 3 3 140d
my-cluster-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
my-cluster-edge-lm6wz Running 140d
my-cluster-edge-pmlls Running 140d
my-cluster-infra-c4v5h Running 140d
my-cluster-infra-mc8rc Running 140d
my-cluster-infra-p9cjv Running 140d
my-cluster-master-0 Running 143d
my-cluster-master-1 Running 143d
my-cluster-master-2 Running 143d
my-cluster-worker-hsjrp Running 140d
my-cluster-worker-v8r9r Running 140d
The oc delete machine command can be used to delete a machine. This will also delete the node associated with the machine and all of the pods running on the node will be evicted/terminated and respawned on a different worker node.
~]$ oc delete machine my-cluster-worker-v8r9r --namespace openshift-machine-api
machine.machine.openshift.io "my-cluster-worker-v8r9r" deleted
While the machine is being deleted, the phase of the machine should be Deleting. There should also be a new machine. At first the phase of the new machine should be Provisioned.
~]$ oc get machines -n openshift-machine-api
NAME PHASE TYPE REGION ZONE AGE
my-cluster-edge-78v55 Running 631d
my-cluster-edge-tk6gm Running 631d
my-cluster-infra-7hpsl Running 631d
my-cluster-infra-jld8v Running 631d
my-cluster-infra-wxjgn Running 631d
my-cluster-master-0 Running 634d
my-cluster-master-1 Running 634d
my-cluster-master-2 Running 634d
my-cluster-worker-hsjrp Running 634d
my-cluster-worker-v8r9r Deleting 140d
my-cluster-worker-sh56r Provisioned 57s
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
my-cluster-edge 2 2 2 2 140d
my-cluster-infra 3 3 3 3 140d
my-cluster-worker 2 1 1 1 143d
Did you find this article helpful?
If so, consider buying me a coffee over at