Add more resources to your cluster: how to resize nodes on running OCP 4.x cluster?
Environment
- Red Hat OpenShift Container Platform (RHOCP)
- 4
- Install Type: IPI
Issue
- Need to increase resources on running IPI RHOCP cluster.
- Nodes do not meet minimum resource requirements.
Resolution
1. First approach is to edit the existing machineset and delete the corresponding machines one by one.
- Confirm the machineset name.
$ oc get machineset -n openshift-machine-api
- Edit the existing machineset to DESIRED spec/FLAVOR.
$ oc edit machineset/<exixting-worker-machineset-name> -n openshift-machine-api
- Sequentially, delete the corresponding machines. Ensure that each machine is back to
Runningstate and the node is present andReadybefore proceeding to the next machine.
$ oc delete machine/<machine-name> -n openshift-machine-api
$ oc get machine -n openshift-machine-api
$ oc get node
2. Second approach is to create a new machineset similar to the ones already present.
- Create a new machineset similar to the ones already present. Review This page is not included, but the link has been rewritten to point to the nearest parent document.Create a compute machine set for cloud providers for more context.
$ oc get machineset -n openshift-machine-api
$ oc get machineset/<exixting-worker-machineset-name> -n openshift-machine-api -oyaml > new-worker.yaml
- Locally EDIT using your preferred editor new-worker.yaml file with DESIRED spec/FLAVOR
$ oc create -f new-worker.yaml
- Scale up new machineset and scale down old one.
$ oc scale --replicas=<DESIRED-NUMBER-OF-MACHINES> machineset/<NEW-machine-set-name> -n openshift-machine-api
$ oc scale --replicas=0 machineset/<OLD-machine-set-name> -n openshift-machine-api
If control plane machines are managed with a control plane machine set, updates to the ControlPlaneMachineSet template are reactive. Changes to CPU, memory, or instance type only apply when a control plane machine is recreated. The Machine API will not automatically delete and recreate existing master nodes simply because the values were modified in the ControlPlaneMachineSet.
-- In some environments, it may also be possible to increase CPU or memory by cordoning and draining a node, shutting it down, and modifying the resources directly from the hypervisor before starting it again. This approach can be quicker for immediate capacity increases and may be considered less disruptive since it avoids deleting and recreating nodes.
Root Cause
Scaling up resources can be done because of various reasons:
- Nodes not meeting minimum resource requirements.
- Nodes have overcommitted resources.
- Nodes have high resource utilization.
This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.