Skip to content

Managing compute nodes

With OpenShift Container Platform, you can manage compute (also known as worker) nodes to create and configure optimal compute capacity for your workloads.

The majority of changes for compute nodes are configured on machine pools. A machine pool is a group of compute nodes in a cluster that have the same configuration, providing ease of management.

You can edit machine pool configuration options such as scaling, adding node labels, and adding taints.

Creating a machine pool

A machine pool is created when you install a OpenShift Container Platform cluster. After installation, you can create additional machine pools for your cluster by using OpenShift Cluster Manager or the ROSA command-line interface (CLI) (rosa).

Note

For users of rosa version 1.2.25 and earlier versions, the machine pool created along with the cluster is identified as Default. For users of rosa version 1.2.26 and later, the machine pool created along with the cluster is identified as worker.

Creating a machine pool

A machine pool is created when you install an OpenShift Container Platform cluster. After installation, you can create additional machine pools for your cluster by using OpenShift Cluster Manager.

Important

The compute (also known as worker) node instance types, autoscaling options, and node counts that are available depend on your OpenShift Container Platform subscriptions, resource quotas and deployment scenario. For more information, contact your sales representative or Red Hat support.

Prerequisites
  • You created an OpenShift Container Platform cluster.

Procedure
  1. Navigate to OpenShift Cluster Manager and select your cluster.

  2. Under the Machine pools tab, click Add machine pool.

  3. Add a Machine pool name.

  4. Select a Compute node instance type from the list. The instance type defines the vCPU and memory allocation for each compute node in the machine pool.

    Note

    You cannot change the instance type for a machine pool after the pool is created.

  5. Optional: Configure autoscaling for the machine pool:

    1. Select Enable autoscaling to automatically scale the number of machines in your machine pool to meet the deployment needs.

    2. Set the minimum and maximum node count limits for autoscaling. The cluster autoscaler does not reduce or increase the machine pool node count beyond the limits that you specify.

      • If you deployed your cluster using a single availability zone, set the Minimum and maximum node count. This defines the minimum and maximum compute node limits in the availability zone.

      • If you deployed your cluster using multiple availability zones, set the Minimum nodes per zone and Maximum nodes per zone. This defines the minimum and maximum compute node limits per zone.

        Note

        Alternatively, you can set your autoscaling preferences for the machine pool after the machine pool is created.

  6. Optional: Add node labels and taints for your machine pool:

    1. Expand the Edit node labels and taints menu.

    2. Under Node labels, add Key and Value entries for your node labels.

    3. Under Taints, add Key and Value entries for your taints.

      Note

      Creating a machine pool with taints is only possible if the cluster already has at least one machine pool without a taint.

    4. For each taint, select an Effect from the drop-down menu. Available options include NoSchedule, PreferNoSchedule, and NoExecute.

      Note

      Alternatively, you can add the node labels and taints after you create the machine pool.

    Important

    Your Amazon EC2 Spot Instances might be interrupted at any time. Use Amazon EC2 Spot Instances only for workloads that can tolerate interruptions.

    +

    Note

    If you select Use Amazon EC2 Spot Instances for a machine pool, you cannot disable the option after the machine pool is created.

    +

  7. Click Add machine pool to create the machine pool.

Verification
  • Verify that the machine pool is visible on the Machine pools page and the configuration is as expected.

Creating a machine pool using the ROSA CLI

You can create additional machine pools for your OpenShift Container Platform cluster by using the ROSA command-line interface (CLI) (rosa).

Note

To add a pre-purchased Capacity Reservation to a machine pool, see Creating a machine pool with Capacity Reservations.

Prerequisites
  • You installed and configured the latest ROSA CLI on your workstation.

  • You logged in to your Red Hat account using the ROSA CLI.

  • You created a OpenShift Container Platform cluster.

Procedure
  • To add a machine pool that does not use autoscaling, create the machine pool and define the instance type, compute (also known as worker) node count, and node labels:

    $ rosa create machinepool --cluster=<cluster-name> \
                              --name=<machine_pool_id> \
                              --replicas=<replica_count> \
                              --instance-type=<instance_type> \
                              --labels=<key>=<value>,<key>=<value> \
                              --taints=<key>=<value>:<effect>,<key>=<value>:<effect> \
                              --disk-size=<disk_size> \
                              --availability-zone=<availability_zone_name> \
                              --additional-security-group-ids <sec_group_id> \
                              --subnet <subnet_id>

    where:

    --name=<machine_pool_id>

    Specifies the name of the machine pool.

    --replicas=<replica_count>

    Specifies the number of compute nodes to provision. If you deployed OpenShift Container Platform using a single availability zone, this defines the number of compute nodes to provision to the machine pool for the zone. If you deployed your cluster using multiple availability zones, this defines the number of compute nodes to provision in total across all zones and the count must be a multiple of 3. The --replicas argument is required when autoscaling is not configured.

    --instance-type=<instance_type>

    Optional: Sets the instance type for the compute nodes in your machine pool. The instance type defines the vCPU and memory allocation for each compute node in the pool. Replace <instance_type> with an instance type. The default is m5.xlarge. You cannot change the instance type for a machine pool after the pool is created.

    --labels=<key>=<value>,<key>=<value>

    Optional: Defines the labels for the machine pool. Replace <key>=<value>,<key>=<value> with a comma-delimited list of key-value pairs, for example --labels=key1=value1,key2=value2.

    --taints=<key>=<value>:<effect>,<key>=<value>:<effect>

    Optional: Defines the taints for the machine pool. Replace <key>=<value>:<effect>,<key>=<value>:<effect> with a key, value, and effect for each taint, for example --taints=key1=value1:NoSchedule,key2=value2:NoExecute. Available effects include NoSchedule, PreferNoSchedule, and NoExecute.

    --disk-size=<disk_size>

    Optional: Specifies the worker node disk size. The value can be in GB, GiB, TB, or TiB. Replace <disk_size> with a numeric value and unit, for example --disk-size=200GiB.

    --availability-zone=<availability_zone_name>
    --additional-security-group-ids <sec_group_id>

    Optional: For machine pools in clusters that do not have Red Hat managed VPCs, you can select additional custom security groups to use in your machine pools. You must have already created the security groups and associated them with the VPC that you selected for this cluster. You cannot add or edit security groups after you create the machine pool.

    --subnet <subnet_id>

    Optional: For BYO VPC clusters, you can select a subnet to create a Single-AZ machine pool. If the subnet is out of your cluster creation subnets, there must be a tag with a key kubernetes.io/cluster/<infra-id> and value shared. Customers can obtain the Infra ID by using the following command:

    $ rosa describe cluster -c <cluster name>|grep "Infra ID:"
    Example output
    Infra ID:                   mycluster-xqvj7

    Note

    You cannot set both --subnet and --availability-zone at the same time, only 1 is allowed for a Single-AZ machine pool creation.

    The following example creates a machine pool called mymachinepool that uses the m5.xlarge instance type and has 2 compute node replicas. The example also adds 2 workload-specific labels:

    $ rosa create machinepool --cluster=mycluster --name=mymachinepool --replicas=2 --instance-type=m5.xlarge --labels=app=db,tier=backend
    Example output
    I: Machine pool 'mymachinepool' created successfully on cluster 'mycluster'
    I: To view all machine pools, run 'rosa list machinepools -c mycluster'
  • To add a machine pool that uses autoscaling, create the machine pool and define the autoscaling configuration, instance type and node labels:

    $ rosa create machinepool --cluster=<cluster-name> \
                              --name=<machine_pool_id> \
                              --enable-autoscaling \
                              --min-replicas=<minimum_replica_count> \
                              --max-replicas=<maximum_replica_count> \
                              --instance-type=<instance_type> \
                              --labels=<key>=<value>,<key>=<value> \
                              --taints=<key>=<value>:<effect>,<key>=<value>:<effect> \
                              --availability-zone=<availability_zone_name> \
                              --use-spot-instances \
                              --spot-max-price=<price>

    where:

    --name=<machine_pool_id>

    Specifies the name of the machine pool. Replace <machine_pool_id> with the name of your machine pool.

    --enable-autoscaling

    Enables autoscaling in the machine pool to meet the deployment needs.

    --min-replicas=<minimum_replica_count> and --max-replicas=<maximum_replica_count>

    Defines the minimum and maximum compute node limits. The cluster autoscaler does not reduce or increase the machine pool node count beyond the limits that you specify.

    If you deployed OpenShift Container Platform using a single availability zone, the --min-replicas and --max-replicas arguments define the autoscaling limits in the machine pool for the zone. If you deployed your cluster using multiple availability zones, the arguments define the autoscaling limits in total across all zones and the counts must be multiples of 3.

    --instance-type=<instance_type>

    Optional: Sets the instance type for the compute nodes in your machine pool. The instance type defines the vCPU and memory allocation for each compute node in the pool. Replace <instance_type> with an instance type. The default is m5.xlarge. You cannot change the instance type for a machine pool after the pool is created.

    --labels=<key>=<value>,<key>=<value>

    Optional: Defines the labels for the machine pool. Replace <key>=<value>,<key>=<value> with a comma-delimited list of key-value pairs, for example --labels=key1=value1,key2=value2.

    --taints=<key>=<value>:<effect>,<key>=<value>:<effect>

    Optional: Defines the taints for the machine pool. Replace <key>=<value>:<effect>,<key>=<value>:<effect> with a key, value, and effect for each taint, for example --taints=key1=value1:NoSchedule,key2=value2:NoExecute. Available effects include NoSchedule, PreferNoSchedule, and NoExecute.

    --availability-zone=<availability_zone_name>

    The following example creates a machine pool called mymachinepool that uses the m5.xlarge instance type and has autoscaling enabled. The minimum compute node limit is 3 and the maximum is 6 overall. The example also adds 2 workload-specific labels:

    $ rosa create machinepool --cluster=mycluster --name=mymachinepool --enable-autoscaling --min-replicas=3 --max-replicas=6 --instance-type=m5.xlarge --labels=app=db,tier=backend
    Example output
    I: Machine pool 'mymachinepool' created successfully on cluster 'mycluster'
    I: To view all machine pools, run 'rosa list machinepools -c mycluster'
Verification

You can list all machine pools on your cluster or describe individual machine pools.

  1. List the available machine pools on your cluster:

    $ rosa list machinepools --cluster=<cluster_name>
    Example output
    ID             AUTOSCALING  REPLICAS  INSTANCE TYPE  LABELS                  TAINTS    AVAILABILITY ZONES                    SPOT INSTANCES
    Default        No           3         m5.xlarge                                        us-east-1a, us-east-1b, us-east-1c    N/A
    mymachinepool  Yes          3-6       m5.xlarge      app=db, tier=backend              us-east-1a, us-east-1b, us-east-1c    No
  2. Describe the information of a specific machine pool in your cluster:

    $ rosa describe machinepool --cluster=<cluster_name> --machinepool=mymachinepool
    Example output
    ID:                         mymachinepool
    Cluster ID:                 27iimopsg1mge0m81l0sqivkne2qu6dr
    Autoscaling:                Yes
    Replicas:                   3-6
    Instance type:              m5.xlarge
    Image type:                 Windows
    Labels:                     app=db, tier=backend
    Taints:
    Availability zones:         us-east-1a, us-east-1b, us-east-1c
    Subnets:
    Spot instances:             No
    Disk size:                  300 GiB
    Security Group IDs:
  3. Verify that the machine pool is included in the output and the configuration is as expected.

Additional resources

Configuring machine pool disk volume

Machine pool disk volume size can be configured for additional flexibility. The default disk size is 300 GiB.

You can configure the machine pool disk size for your cluster by using OpenShift Cluster Manager or the ROSA command-line interface (CLI) (rosa).

Note

Existing cluster and machine pool node volumes cannot be resized.

Prerequisite for cluster creation
  • You have the option to select the node disk sizing for the default machine pool during cluster installation.

Procedure for cluster creation
  1. From the OpenShift Container Platform cluster wizard, navigate to Cluster settings.

  2. Navigate to Machine pool step.

  3. Select the desired Root disk size.

  4. Select Next to continue creating your cluster.

Prerequisite for machine pool creation
  • You have the option to select the node disk sizing for the new machine pool after the cluster has been installed.

Procedure for machine pool creation
  1. Navigate to OpenShift Cluster Manager and select your cluster.

  2. Navigate to Machine pool tab.

  3. Click Add machine pool.

  4. Select the desired Root disk size.

  5. Select Add machine pool to create the machine pool.

Configuring machine pool disk volume using the ROSA CLI

Prerequisite for cluster creation
  • You have the option to select the root disk sizing for the default machine pool during cluster installation.

Procedure for cluster creation
  • Run the following command when creating your OpenShift cluster for the desired root disk size:

    $ rosa create cluster --worker-disk-size=<disk_size>

    The value can be in GB, GiB, TB, or TiB. Replace <disk_size> with a numeric value and unit, for example --worker-disk-size=200GiB. You cannot separate the digit and the unit. No spaces are allowed.

Prerequisite for machine pool creation
  • You have the option to select the root disk sizing for the new machine pool after the cluster has been installed.

Procedure for machine pool creation
  1. Scale up the cluster by executing the following command:

    $ rosa create machinepool --cluster=<cluster_id> \
                              --disk-size=<disk_size> 
    1. Specifies the ID or name of your existing OpenShift cluster.
    2. Specifies the worker node disk size. The value can be in GB, GiB, TB, or TiB. Replace <disk_size> with a numeric value and unit, for example --disk-size=200GiB. You cannot separate the digit and the unit. No spaces are allowed.
  2. Confirm new machine pool disk volume size by logging into the AWS console and find the EC2 virtual machine root volume size.

Additional resources

Deleting a machine pool

You can delete a machine pool in the event that your workload requirements have changed and your current machine pools no longer meet your needs.

You can delete machine pools using Red Hat OpenShift Cluster Manager.

Prerequisites
  • You have created an OpenShift Container Platform cluster.

  • The cluster is in the ready state.

  • You have an existing machine pool without any taints and with at least two replicas for a Single-AZ cluster or three replicas for a Multi-AZ cluster.

Procedure
  1. From OpenShift Cluster Manager, navigate to the Cluster List page and select the cluster that contains the machine pool that you want to delete.

  2. On the selected cluster, select the Machine pools tab.

  3. Under the Machine pools tab, click the Options menu kebab for the machine pool that you want to delete.

  4. Click Delete.

The selected machine pool is deleted.

Deleting a machine pool

You can delete a machine pool for your OpenShift Container Platform cluster by using Red Hat OpenShift Cluster Manager.

Prerequisites
  • You have created an OpenShift Container Platform cluster.

  • The newly created cluster is in the ready state.

Procedure
  1. From OpenShift Cluster Manager, navigate to the Cluster List page and select the cluster that contains the machine pool that you want to delete.

  2. On the selected cluster, select the Machine pools tab.

  3. Under the Machine pools tab, click the Options menu kebab for the machine pool that you want to delete.

  4. Click Delete.

    The selected machine pool is deleted.

Deleting a machine pool using the ROSA CLI

You can delete a machine pool for your OpenShift Container Platform cluster by using the ROSA command-line interface (CLI) (rosa).

Note

For users of rosa version 1.2.25 and earlier versions, the machine pool (ID='Default') that is created along with the cluster cannot be deleted. For users of rosa version 1.2.26 and later, the machine pool (ID='worker') that is created along with the cluster can be deleted if there is one machine pool within the cluster that contains no taints, and at least two replicas for a Single-AZ cluster or three replicas for a Multi-AZ cluster.

Prerequisites
  • You have created an OpenShift Container Platform cluster.

Procedure
  1. From the ROSA CLI, run the following command:

    $ rosa delete machinepool -c=<cluster_name> <machine_pool_ID>
    Example output
    ? Are you sure you want to delete machine pool <machine_pool_ID> on cluster <cluster_name>? (y/N)
  2. Enter y to delete the machine pool.

    The selected machine pool is deleted.

Scaling compute nodes manually

If you have not enabled autoscaling for your machine pool, you can manually scale the number of compute (also known as worker) nodes in the pool to meet your deployment needs.

You must scale each machine pool separately.

Prerequisites
  • You created an OpenShift Container Platform cluster.

  • You have an existing machine pool.

Node labels

Procedure

A label is a key-value pair applied to a Node object. You can use labels to organize sets of objects and control the scheduling of pods.

You can add labels during cluster creation or after. Labels can be modified or updated at any time.

Additional resources

Adding node labels to a machine pool

Add or edit labels for compute (also known as worker) nodes at any time to manage the nodes in a manner that is relevant to you. For example, you can assign types of workloads to specific nodes.

Labels are assigned as key-value pairs. Each key must be unique to the object it is assigned to.

Prerequisites
  • You created an OpenShift Container Platform cluster.

  • You have an existing machine pool.

Adding tags to a machine pool

Procedure

You can add tags for compute nodes, also known as worker nodes, in a machine pool to introduce custom user tags for AWS resources that are generated when you provision your machine pool, noting that you can not edit the tags after you create the machine pool.

Adding tags to a machine pool using the ROSA CLI

You can add tags to a machine pool for your OpenShift Container Platform cluster by using the ROSA command-line interface (CLI) (rosa). You can not edit the tags after after you create the machine pool.

Important

You must ensure that your tag keys are not aws, red-hat-managed, red-hat-clustertype, or Name. In addition, you must not set a tag key that begins with kubernetes.io/cluster/. Your tag’s key cannot be longer than 128 characters, while your tag’s value cannot be longer than 256 characters. Red Hat reserves the right to add additional reserved tags in the future.

Prerequisites
  • You installed and configured the latest AWS (aws), ROSA (rosa), and OpenShift (oc) CLIs on your workstation.

  • You logged in to your Red Hat account by using the ROSA CLI.

  • You created a OpenShift Container Platform cluster.

Procedure
  • Create a machine pool with a custom tag by running the following command:

    $ rosa create machinepools --cluster=<name> --replicas=<replica_count> \
         --name <mp_name> --tags='<key> <value>,<key> <value>' 
    1. Replace <key> <value>,<key> <value> with a key and value for each tag.
    Example output
    $ rosa create machinepools --cluster=mycluster --replicas 2 --tags='tagkey1 tagvalue1,tagkey2 tagvaluev2'
    
    I: Checking available instance types for machine pool 'mp-1'
    I: Machine pool 'mp-1' created successfully on cluster 'mycluster'
    I: To view the machine pool details, run 'rosa describe machinepool --cluster mycluster --machinepool mp-1'
    I: To view all machine pools, run 'rosa list machinepools --cluster mycluster'
Verification
  • Use the describe command to see the details of the machine pool with the tags, and verify that the tags are included for your machine pool in the output:

    $ rosa describe machinepool --cluster=<cluster_name> --machinepool=<machinepool_name>
    Example output
    ID:                                    mp-1
    Cluster ID:                            2baiirqa2141oreotoivp4sipq84vp5g
    Autoscaling:                           No
    Replicas:                              2
    Instance type:                         m5.xlarge
    Labels:
    Taints:
    Availability zones:                    us-east-1a
    Subnets:
    Spot instances:                        No
    Disk size:                             300 GiB
    Additional Security Group IDs:
    Tags:                                  red-hat-clustertype=rosa, red-hat-managed=true, tagkey1=tagvalue1, tagkey2=tagvaluev2

Adding taints to a machine pool

You can add taints for compute (also known as worker) nodes in a machine pool to control which pods are scheduled to them. When you apply a taint to a machine pool, the scheduler cannot place a pod on the nodes in the pool unless the pod specification includes a toleration for the taint.

Note

A cluster must have at least one machine pool that does not contain any taints.

Prerequisites
  • You created an OpenShift Container Platform cluster.

  • You have an existing machine pool that does not contain any taints and contains at least two instances.

Adding taints to a machine pool using OpenShift Cluster Manager

You can add taints to a machine pool for your OpenShift Container Platform cluster by using Red Hat OpenShift Cluster Manager.

Prerequisites
  • You created an OpenShift Container Platform cluster.

  • You have an existing machine pool that does not contain any taints and contains at least two instances.

Procedure
  1. Navigate to OpenShift Cluster Manager and select your cluster.

  2. Under the Machine pools tab, click the Options menu kebab for the machine pool that you want to add a taint to.

  3. Select Edit taints.

  4. Add Key and Value entries for your taint.

  5. Select an Effect for your taint from the list. Available options include NoSchedule, PreferNoSchedule, and NoExecute.

  6. Optional: Select Add taint if you want to add more taints to the machine pool.

  7. Click Save to apply the taints to the machine pool.

Verification
  1. Under the Machine pools tab, select > next to your machine pool to expand the view.

  2. Verify that your taints are listed under Taints in the expanded view.

Adding taints to a machine pool using the ROSA CLI

You can add taints to a machine pool for your OpenShift Container Platform cluster by using the ROSA command-line interface (CLI) (rosa).

Note

For users of rosa version 1.2.25 and prior versions, the number of taints cannot be changed within the machine pool (ID=Default) created along with the cluster. For users of rosa version 1.2.26 and beyond, the number of taints can be changed within the machine pool (ID=worker) created along with the cluster. There must be at least one machine pool without any taints and with at least two replicas for a Single-AZ cluster or three replicas for a Multi-AZ cluster.

Prerequisites
  • You created an OpenShift Container Platform cluster.

  • You have an existing machine pool that does not contain any taints and contains at least two instances.