Bootstrap FreeKB - OpenShift - Add machines nodes using the oc scale machineset command
OpenShift - Add machines nodes using the oc scale machineset command

Updated:   |  OpenShift articles

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

A node (sometimes also referred to as a "machine") contains one or more pods, and each pod contains one or more containers.

 

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
my-edge         2         2         2       2           140d
my-infra        3         3         3       3           140d
my-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-edge-lm6wz         Running                          140d
my-edge-pmlls         Running                          140d
my-infra-c4v5h        Running                          140d
my-infra-mc8rc        Running                          140d
my-infra-p9cjv        Running                          140d
my-master-0           Running                          143d
my-master-1           Running                          143d
my-master-2           Running                          143d
my-worker-hsjrp       Running                          140d
my-worker-v8r9r       Running                          140d

 

The oc get nodes command will return the list of nodes. Notice that the 2 worker nodes are listed.

oc get nodes
. . .
NAME         STATUS    ROLES     AGE       VERSION
mynode001    Ready     infra     273d      v1.11.0+d4cacc0
mynode002    Ready     infra     273d      v1.11.0+d4cacc0
mynode003    Ready     infra     273d      v1.11.0+d4cacc0
mynode004    Ready     compute   273d      v1.11.0+d4cacc0
mynode005    Ready     compute   273d      v1.11.0+d4cacc0
mynode006    Ready     master    273d      v1.11.0+d4cacc0
mynode007    Ready     master    273d      v1.11.0+d4cacc0

 

The oc scale machineset command can be used to add edge, infra or worker machines. In this example, the worker machine set is scale up to 3, adding one additional worker.

~]# oc scale machineset my-worker --replicas=3 --namespace openshift-machine-api
machineset.machine.openshift.io/my-worker scaled

 

The oc get machineset command should now show that the DESIRED/CURRENT count is 3, but the READY/AVAILABLE count will still be 2 for some time.

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

 

Likewise, the oc get machines command should show that the new machines are Provisioning. It can take a while for the machine to go from Provisioning to Running.

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

 

AVOID TROUBLE

If for some reason the state remains Provisioning for a long time (e.g. 10 minutes or longer), use the oc get events command to see if there is some issue with the machine. Here is but one possibility.

~]$ oc get events
LAST SEEN   TYPE      REASON         OBJECT                         MESSAGE
7m43s       Warning   FailedCreate   machine/my-worker-j5556        my-worker-j5556: reconciler failed to Create machine: error getting network specs: multiple networks found, specify one in config

 




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