Chapter 4. Modifying a machine set You can modify a machine set, such as adding labels, changing the instance type, or changing block storage. On Red Hat Virtualization (RHV), you can also change a machine set to provision new nodes on a different storage domain. Note If you need to scale a machine set without making other changes, see Manually scaling a machine set . 4.1. Modifying a machine set To make changes to a machine set, edit the MachineSet YAML. Then, remove all machines associated with the machine set by deleting each machine or scaling down the machine set to 0 replicas. Then, scale the replicas back to the desired number. Changes you make to a machine set do not affect existing machines. If you need to scale a machine set without making other changes, you do not need to delete the machines. Note By default, the OpenShift Container Platform router pods are deployed on workers. Because the router is required to access some cluster resources, including the web console, do not scale the worker machine set to 0 unless you first relocate the router pods. Prerequisites Install an OpenShift Container Platform cluster and the oc command line. Log in to oc as a user with cluster-admin permission. Procedure Edit the machine set: USD oc edit machineset <machineset> -n openshift-machine-api Scale down the machine set to 0 : USD oc scale --replicas=0 machineset <machineset> -n openshift-machine-api Or: USD oc edit machineset <machineset> -n openshift-machine-api Wait for the machines to be removed. Scale up the machine set as needed: USD oc scale --replicas=2 machineset <machineset> -n openshift-machine-api Or: USD oc edit machineset <machineset> -n openshift-machine-api Wait for the machines to start. The new machines contain changes you made to the machine set. 4.2. Migrating nodes to a different storage domain on RHV You can migrate the OpenShift Container Platform control plane and compute nodes to a different storage domain in a Red Hat Virtualization (RHV) cluster. 4.2.1. Migrating compute nodes to a different storage domain in RHV Prerequisites You are logged in to the Manager. You have the name of the target storage domain. Procedure Identify the virtual machine template: USD oc get -o jsonpath='{.items[0].spec.template.spec.providerSpec.value.template_name}{"\n"}' machineset -A Create a new virtual machine in the Manager, based on the template you identified. Leave all other settings unchanged. For details, see Creating a Virtual Machine Based on a Template in the Red Hat Virtualization Virtual Machine Management Guide . Tip You do not need to start the new virtual machine. Create a new template from the new virtual machine. Specify the target storage domain under Target . For details, see Creating a Template in the Red Hat Virtualization Virtual Machine Management Guide . Add a new machine set to the OpenShift Container Platform cluster with the new template. Get the details of the current machine set: USD oc get machineset -o yaml Use these details to create a machine set. For more information see Creating a machine set . Enter the new virtual machine template name in the template_name field. Use the same template name you used in the New template dialog in the Manager. Note the names of both the old and new machine sets. You need to refer to them in subsequent steps. Migrate the workloads. Scale up the new machine set. For details on manually scaling machine sets, see Scaling a machine set manually . OpenShift Container Platform moves the pods to an available worker when the old machine is removed. Scale down the old machine set. Remove the old machine set: USD oc delete machineset <machineset-name> Additional resources Creating a machine set . Scaling a machine set manually Controlling pod placement using the scheduler 4.2.2. Migrating control plane nodes to a different storage domain on RHV OpenShift Container Platform does not manage control plane nodes, so they are easier to migrate than compute nodes. You can migrate them like any other virtual machine on Red Hat Virtualization (RHV). Perform this procedure for each node separately. Prerequisites You are logged in to the Manager. You have identified the control plane nodes. They are labeled master in the Manager. Procedure Select the virtual machine labeled master . Shut down the virtual machine. Click the Disks tab. Click the virtual machine's disk. Click More Actions and select Move . Select the target storage domain and wait for the migration process to complete. Start the virtual machine. Verify that the OpenShift Container Platform cluster is stable: USD oc get nodes The output should display the node with the status Ready . Repeat this procedure for each control plane node.

Commands:
oc edit machineset <machineset> -n openshift-machine-api
oc scale --replicas=0 machineset <machineset> -n openshift-machine-api
oc edit machineset <machineset> -n openshift-machine-api
oc scale --replicas=2 machineset <machineset> -n openshift-machine-api
oc edit machineset <machineset> -n openshift-machine-api
oc get -o jsonpath='{.items[0].spec.template.spec.providerSpec.value.template_name}{"\n"}' machineset -A
oc get machineset -o yaml
oc delete machineset <machineset-name>
oc get nodes