Creating controlplanemachineset in OpenShift 4 clusters in vSphere
Environment
- Red Hat OpenShift Container Platform (RHOCP)
- 4
- VMware vSphere
- IPI
Issue
- There is no
controlplanemachinesetresource in the OpenShift 4 cluster installed in vSphere to manage the control plane, while it is already supported since version 4.12. - How to create a
controlplanemachinesetresource in an OpenShift 4 cluster installed in vSphere?
Resolution
Starting with OpenShift 4.16, the control plane machine set Custom Resource is automatically created at installation time, and it requires manual activation of the Custom Resource for cluster upgraded from previous versions.
Workaround for older releases
As explained in [creating a control plane machine set custom resource](https://docs.openshift.com/container-platform/4.12/machine_management/control_plane_machine_management/cpmso-getting-started.html#cpmso-creating-cr_cpmso-getting-started), it is needed to create the main part of the `controlplanemachineset` as per the example in the documentation, and only few things needs to be changed from the template.
Create a cpms.yaml file with the content in the example linked above, and change the following:
-
The
<cluster_id>which appears in two different places. The value for it can be obtained with the following command:$ oc get infrastructure cluster -o jsonpath='{.status.infrastructureName}{"\n"}' -
The
failureDomainsconfiguration. For vSphere, it is needed to remove thefailureDomainsfield and related config, as it is not yet supported in thecontrolplanemachinesetat this moment. Refer to ControlPlaneMachineSet cannot be created with emptyfailureDomainsfor OpenShift 4 in vSphere for additional information. -
The
providerSpecconfiguration (note that the indentation is different in the resource it is collected and the resource in which it will be placed):
3.1. Get theproviderSpecfrom one of the current master machines:$ oc get machines -l "machine.openshift.io/cluster-api-machine-role=master" -n openshift-machine-api [...] $ oc get machines [master_machine_name] -n openshift-machine-api -o yaml [...] providerSpec: value: [...] status: [...]
3.2. The same <cluster_id> gathered in step 1 can be added to the providerSpec.value.metadata.name field, but it is not required for vSphere as per the documentation (and that field could be not present in the providerSpec from the machine resource):
```
metadata:
creationTimestamp: null
name: <cluster_id>
```
3.3. Ensure the indentation of the providerSpec is correct before putting the content in the yaml file.
4. Set the spec.state to Inactive:
```
state: Inactive
```
- If any change from the original
providerSpecis desired, like differentdiskGiBor differentmemoryMiB, change it in the file accordingly.
When the yaml file is created as explained above, and ensuring the indentation of the providerSpec inside the file is correct, create the resource from the file and check that the resource was created:
$ oc apply -f cpms.yaml
[...]
$ oc get controlplanemachinesets -n openshift-machine-api
NAME DESIRED CURRENT READY UPDATED UNAVAILABLE STATE AGE
cluster 3 3 3 3 Inactive 43s
If the resource is created with no errors, it is now possible to activate it, setting the spec.state to Active:
$ oc edit controlplanemachineset cluster -n openshift-machine-api
[...]
state: Active
[...]
It is possible to check the status of the controlplanemachineset and the machines and nodes while the new machines are being created with the following commands:
$ oc get controlplanemachinesets -n openshift-machine-api
NAME DESIRED CURRENT READY UPDATED UNAVAILABLE STATE AGE
cluster 3 3 3 3 Active 4m9s
$ oc get machines -n openshift-machine-api
[...]
$ oc get nodes
[...]
Root Cause
Starting with OpenShift 4.12, This page is not included, but the link has been rewritten to point to the nearest parent document.control plane machine sets were introduced to provide management capabilities for the control plane machines. They are similar to what compute machine sets provide for compute machines.
For OpenShift 4 installed in vSphere, while the ControlPlaneMachineSets are supported, the controlplanemachineset is not automatically created as explained in supported cloud providers (the automatic creation during the installation of OpenShift 4.15 is available as a Technology Preview feature).
Diagnostic Steps
Check if the controlplanemachineset resource is already present and the status:
$ oc get controlplanemachinesets -n openshift-machine-api
After creating or modifying the controlplanemachineset resource, it is possible to check the status and the creation of the new machines with the new configuration with the following commands:
$ oc get controlplanemachinesets -n openshift-machine-api
NAME DESIRED CURRENT READY UPDATED UNAVAILABLE STATE AGE
cluster 3 3 3 3 Active 4m9s
$ oc get machines -n openshift-machine-api
[...]
$ oc get nodes
[...]
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.