This is a cache of https://docs.openshift.com/rosa/cloud_experts_tutorials/cloud-experts-getting-started/cloud-experts-getting-started-managing-worker-nodes.html. It is a snapshot of the page at 2024-11-25T03:02:51.469+0000.
Managing worker nodes - Getting started with ROSA | Tutorials | Red Hat OpenShift <strong>service</strong> on AWS
×

In Red Hat OpenShift service on AWS (ROSA), changing aspects of your worker nodes is performed through the use of machine pools. A machine pool allows users to manage many machines as a single entity. Every ROSA cluster has a default machine pool that is created when the cluster is created. For more information, see the machine pool documentation.

Creating a machine pool

You can create a machine pool with either the command line interface (CLI) or the user interface (UI).

Creating a machine pool with the CLI

  1. Run the following command:

    rosa create machinepool --cluster=<cluster-name> --name=<machinepool-name> --replicas=<number-nodes>
    Example input
     $ rosa create machinepool --cluster=my-rosa-cluster --name=new-mp
     --replicas=2
    Example output
    I: Machine pool 'new-mp' created successfully on cluster 'my-rosa-cluster'
    I: To view all machine pools, run 'rosa list machinepools -c my-rosa-cluster'
  2. Optional: Add node labels or taints to specific nodes in a new machine pool by running the following command:

    rosa create machinepool --cluster=<cluster-name> --name=<machinepool-name> --replicas=<number-nodes> --labels=`<key=pair>`
    Example input
    $ rosa create machinepool --cluster=my-rosa-cluster --name=db-nodes-mp --replicas=2 --labels='app=db','tier=backend'
    Example output
    I: Machine pool 'db-nodes-mp' created successfully on cluster 'my-rosa-cluster'

    This creates an additional 2 nodes that can be managed as a unit and also assigns them the labels shown.

  3. Run the following command to confirm machine pool creation and the assigned labels:

    rosa list machinepools --cluster=<cluster-name>
    Example output
    ID          AUTOSCALING  REPLICAS  INSTANCE TYPE  LABELS            TAINTS    AVAILABILITY ZONES
    Default     No           2         m5.xlarge                                  us-east-1a

Creating a machine pool with the UI

  1. Log in to the OpenShift Cluster Manager and click your cluster.

    cloud experts getting started managing ocm cluster
  2. Click Machine pools.

    cloud experts getting started managing mp ocm

  3. Click Add machine pool.

  4. Enter the desired configuration.

    You can also and expand the Edit node labels and taints section to add node labels and taints to the nodes in the machine pool.

    cloud experts getting started managing mp nlt
  5. You will see the new machine pool you created.

    cloud experts getting started managing mp fromui

Scaling worker nodes

Edit a machine pool to scale the number of worker nodes in that specific machine pool. You can use either the CLI or the UI to scale worker nodes.

Scaling worker nodes using the CLI

  1. Run the following command to see the default machine pool that is created with each cluster:

    rosa list machinepools --cluster=<cluster-name>
    Example output
    ID          AUTOSCALING  REPLICAS  INSTANCE TYPE  LABELS            TAINTS    AVAILABILITY ZONES
    Default     No           2         m5.xlarge                                  us-east-1a
  2. To scale the default machine pool out to a different number of nodes, run the following command:

    rosa edit machinepool --cluster=<cluster-name> --replicas=<number-nodes> <machinepool-name>
    Example input
    rosa edit machinepool --cluster=my-rosa-cluster --replicas 3 Default
  3. Run the following command to confirm that the machine pool has scaled:

    rosa describe cluster --cluster=<cluster-name> | grep Compute
    Example input
    $ rosa describe cluster --cluster=my-rosa-cluster | grep Compute
    Example output
    - Compute:                 3 (m5.xlarge)

Scaling worker nodes using the UI

  1. Click the three dots to the right of the machine pool you want to edit.

  2. Click Edit.

  3. Enter the desired number of nodes, and click Save.

  4. Confirm that the cluster has scaled by selecting the cluster, clicking the Overview tab, and scrolling to Compute listing. The compute listing should equal the scaled nodes. For example, 3/3.

    cloud experts getting started managing ocm nodes

Adding node labels

  1. Use the following command to add node labels:

    rosa edit machinepool --cluster=<cluster-name> --replicas=<number-nodes> --labels='key=value' <machinepool-name>
    Example input
    rosa edit machinepool --cluster=my-rosa-cluster --replicas=2 --labels 'foo=bar','baz=one' new-mp

    This adds 2 labels to the new machine pool.

This command replaces all machine pool configurations with the newly defined configuration. If you want to add another label and keep the old label, you must state both the new and preexisting the label. Otherwise the command will replace all preexisting labels with the one you wanted to add. Similarly, if you want to delete a label, run the command and state the ones you want, excluding the one you want to delete.

Mixing node types

You can also mix different worker node machine types in the same cluster by using new machine pools. You cannot change the node type of a machine pool once it is created, but you can create a new machine pool with different nodes by adding the --instance-type flag.

  1. For example, to change the database nodes to a different node type, run the following command:

    rosa create machinepool --cluster=<cluster-name> --name=<mp-name> --replicas=<number-nodes> --labels='<key=pair>' --instance-type=<type>
    Example input
    rosa create machinepool --cluster=my-rosa-cluster --name=db-nodes-large-mp --replicas=2 --labels='app=db','tier=backend' --instance-type=m5.2xlarge
  2. To see all the instance types available, run the following command:

    rosa list instance-types
  3. To make step-by-step changes, use the --interactive flag:

    rosa create machinepool -c <cluster-name> --interactive
    cloud experts getting started managing mp interactive
  4. Run the following command to list the machine pools and see the new, larger instance type:

    rosa list machinepools -c <cluster-name>
    cloud experts getting started managing large mp