Modifying a compute machine set

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

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.

Additional resources

Additional resources