+++
title = "Managing Nodes"
chapter = false
weight = 1
+++


:imagesdir: /images

## Managing Worker Nodes

When using your cluster there may be times when you need to change aspects of your worker nodes. Things like scaling, changing the type, adding labels or taints to name a few. Most of these things are done through the use of machine pools in ROSA. Think of a machine pool as a “template” for the kinds of machines that make up the worker nodes of your cluster. A machine pool allows users to manage many machines as a single entity.

### Scaling worker nodes

To scale the number of worker nodes we need to edit the machine pool they belong to. The default machine pool is called “default” which is created with every cluster.

Step 1:: View existing machine pools:

----
rosa list machinepools --cluster=<cluster-name>
----

    You will see a response like:

        ID         AUTOSCALING  REPLICAS  INSTANCE TYPE  LABELS   TAINTS    AVAILABILITY ZONES
        default    No           2         m5.xlarge                         us-east-1a

Step 2:: Scale up the by adding additional nodes.

----
rosa edit machinepool --cluster=<cluster-name> --replicas <number-worker-nodes> <machinepool-name>
----

    For example:

    `rosa edit machinepool --cluster=my-rosa-cluster --replicas 3 default`

Step 3:: Confirm scaling

----
rosa describe cluster --cluster=<cluster-name>
----

    You will see a response showing 3 compute nodes:

        $ rosa describe cluster --cluster=my-rosa-cluster
        Name:                       my-rosa-cluster
        ID:                         1jgpoh4jm5jjiu12k12h000000000000
        External ID:                a3fa460d-6405-48aa-ad24-000000000000
        OpenShift Version:          4.7.2
        Channel Group:              stable
        DNS:                        my-rosa-cluster.abcd.p1.openshiftapps.com
        AWS Account:                000000000000
        API URL:                    https://api.my-rosa-cluster.abcd.p1.openshiftapps.com:6443
        Console URL:                https://console-openshift-console.apps.my-rosa-cluster.abcd.p1.openshiftapps.com
        Region:                     us-east-1
        Multi-AZ:                   false
        Nodes:
         - Master:                  3
         - Infra:                   2
         - Compute:                 3 (m5.xlarge)
        Network:
         - Service CIDR:            172.30.0.0/16
         - Machine CIDR:            10.0.0.0/16
         - Pod CIDR:                10.128.0.0/14
         - Host Prefix:             /23
        State:                      ready 
        Private:                    No
        Created:                    Mar 19 2021 00:03:19 UTC
        Details Page:               https://cloud.redhat.com/openshift/details/1jgpoh4jm5jjiu12k12h000000000000

image::7-describe.png[Rosa init]
    

This can also be confirmed by accessing OCM (<https://cloud.redhat.com/openshift>) and selecting the cluster, on the overview tab, scroll down to the middle section under details you will see Compute listing "3/3".

image::7-ocm_cluster.png[Rosa init]
    
image::7-ocm_nodes.png[Rosa init]

This is a manual scaling action, either manually increasing or decreasing the number of worker nodes. See the AutoScaling module for info on how to enable dynamic scaling of compute resources.


### Adding node labels

Node Lables allow for specific workloads to be placed in on certain nodes. This may be to place workloads on certain compute types such as GPU. This can also be helpful for performance sensitive workloads ensuring they run in same hosts.  We can create a new machine pool to add the node labels to the worker nodes created by it.


Step 1:: Create machinepool with a label.

----
rosa create machinepool --cluster=<cluster-name> --name=<mp-name> --replicas=<number-nodes> --labels=’<key=pair>
----


    For example:

        $ rosa create machinepool --cluster=my-rosa-cluster --name=db-nodes-mp --replicas=2 --labels='app=db','tier=backend'
        I: Machine pool 'db-nodes-mp' created successfully on cluster 'my-rosa-cluster'
        
    This will create an additional 2 nodes that can be managed as one unit and also assign them the labels shown.  

Step 2:: Confirm labels

----
rosa list machinepools --cluster=<cluster-name>
----

image::7-new_mp.png[Rosa init]
	

### Using different node types

You cannot change the node type of a machine pool once created, but we can create a new machine pool with the larger nodes by adding the `--instance-type` flag.


Step 3:: Create machine pool 

    ----
    rosa create machinepool --cluster=<cluster-name> --name=<mp-name> --replicas=<number-nodes> --labels=’<key=pair>’ --instance-type=<type>
    ----

	For example:
	
    `rosa create machinepool --cluster=my-rosa-cluster --name=db-nodes-large-mp --replicas=2 --labels='app=db','tier=backend' --instance-type=m5.2xlarge`


If you’d like to see all the [instance types available](https://docs.openshift.com/rosa/rosa_policy/rosa-service-definition.html#rosa-sdpolicy-aws-compute-types_rosa-service-definition), or to make the decisions step-by-step, then use the `--interactive` flag:

Step 4:: Create machinepool interactive mode

----
rosa create machinepool -c <cluster-name> --interactive
----
   

image::7-mp_interactive.png[Rosa init]
    

1. List the machine pools to see the new larger instance type

image::7-large_mp.png[Rosa init]


