Creating controlplanemachineset in OpenShift 4.12 clusters in Azure

Solution Unverified - Updated

Environment

  • Red Hat OpenShift Container Platform (RHOCP)
    • 4.12
  • Azure IPI

Issue

  • There is no controlplanemachineset resource in the OpenShift 4.12 cluster installed in Azure to manage the control plane, while it is already supported.
  • How to create a controlplanemachineset resource in the OpenShift 4.12 cluster installed in Azure?

Resolution

As explained in creating a control plane machine set custom resource, 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:

  1. 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"}'
    
  2. The failureDomains configuration. For Azure, it can be checked with the following command if 1 or 3 Availability Zones are in use:

    $ oc get machines -l "machine.openshift.io/cluster-api-machine-role=master" -n openshift-machine-api -o yaml | grep zone
    

    With the output of above command, the exact configuration for the failureDomains can be seen in the sample Azure failure domain configuration.

  3. The providerSpec configuration (note that the indentation is different in the resource it is collected and the resource in which it will be placed):
    3.1. Get the providerSpec from 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. Add the same <cluster_id> gathered in step 1 to providerSpec.value.metadata.name (that field could be not present in the providerSpec from the machine resource):

```
    metadata:
      creationTimestamp: null
      name: <cluster_id>
```

3.3. If three Availability Zones are configured, leave the providerSpec.value.zone at the end of the providerSpec empty:

```
      zone: ""
```

3.4. 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
```
  1. If any change from the original providerSpec is desired, like different diskSizeGB or different vmSize, 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.12 installed in Azure, while the ControlPlaneMachineSets are supported, the controlplanemachineset is not automatically created as explained in supported cloud providers.

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
[...]
Category

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.