Modifying a compute machine set

You can modify a compute machine set, such as adding labels, changing the instance type, or changing block storage.

On oVirt, you can also change a compute machine set to provision new nodes on a different storage domain.

If you need to scale a compute machine set without making other changes, see Manually scaling a compute machine set.

Modifying a compute machine set

To make changes to a compute machine set, edit the MachineSet YAML. Then, remove all machines associated with the compute machine set by deleting each machine or scaling down the compute machine set to 0 replicas. Then, scale the replicas back to the desired number. Changes you make to a compute machine set do not affect existing machines.

If you need to scale a compute machine set without making other changes, you do not need to delete the machines.

By default, the OKD router pods are deployed on workers. Because the router is required to access some cluster resources, including the web console, do not scale the compute machine set to 0 unless you first relocate the router pods.

Prerequisites

  • Install an OKD cluster and the oc command line.

  • Log in to oc as a user with cluster-admin permission.

Procedure

  1. Edit the compute machine set by running the following command:

    1. $ oc edit machineset <machineset> -n openshift-machine-api
  2. Scale down the compute machine set to 0 by running one of the following commands:

    1. $ oc scale --replicas=0 machineset <machineset> -n openshift-machine-api

    Or:

    1. $ oc edit machineset <machineset> -n openshift-machine-api

    You can alternatively apply the following YAML to scale the compute machine set:

    1. apiVersion: machine.openshift.io/v1beta1
    2. kind: MachineSet
    3. metadata:
    4. name: <machineset>
    5. namespace: openshift-machine-api
    6. spec:
    7. replicas: 0

    Wait for the machines to be removed.

  3. Scale up the compute machine set as needed by running one of the following commands:

    1. $ oc scale --replicas=2 machineset <machineset> -n openshift-machine-api

    Or:

    1. $ oc edit machineset <machineset> -n openshift-machine-api

    You can alternatively apply the following YAML to scale the compute machine set:

    1. apiVersion: machine.openshift.io/v1beta1
    2. kind: MachineSet
    3. metadata:
    4. name: <machineset>
    5. namespace: openshift-machine-api
    6. spec:
    7. replicas: 2

    Wait for the machines to start. The new machines contain changes you made to the compute machine set.

Migrating nodes to a different storage domain on oVirt

You can migrate the OKD control plane and compute nodes to a different storage domain in a oVirt cluster.

Migrating compute nodes to a different storage domain in oVirt

Prerequisites

  • You are logged in to the Engine.

  • You have the name of the target storage domain.

Procedure

  1. Identify the virtual machine template by running the following command:

    1. $ oc get -o jsonpath='{.items[0].spec.template.spec.providerSpec.value.template_name}{"\n"}' machineset -A
  2. Create a new virtual machine in the Engine, 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.

    You do not need to start the new virtual machine.

  3. 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.

  4. Add a new compute machine set to the OKD cluster with the new template.

    1. Get the details of the current compute machine set by running the following command:

      1. $ oc get machineset -o yaml
    2. Use these details to create a compute machine set. For more information see Creating a compute 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 Engine.

    3. Note the names of both the old and new compute machine sets. You need to refer to them in subsequent steps.

  5. Migrate the workloads.

    1. Scale up the new compute machine set. For details on manually scaling compute machine sets, see Scaling a compute machine set manually.

      OKD moves the pods to an available worker when the old machine is removed.

    2. Scale down the old compute machine set.

  6. Remove the old compute machine set by running the following command:

    1. $ oc delete machineset <machineset-name>

Additional resources

Migrating control plane nodes to a different storage domain on oVirt

OKD 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 oVirt.

Perform this procedure for each node separately.

Prerequisites

  • You are logged in to the Engine.

  • You have identified the control plane nodes. They are labeled master in the Engine.

Procedure

  1. Select the virtual machine labeled master.

  2. Shut down the virtual machine.

  3. Click the Disks tab.

  4. Click the virtual machine’s disk.

  5. Click More Actionskebab and select Move.

  6. Select the target storage domain and wait for the migration process to complete.

  7. Start the virtual machine.

  8. Verify that the OKD cluster is stable:

    1. $ oc get nodes

    The output should display the node with the status Ready.

  9. Repeat this procedure for each control plane node.