|
| 1 | +// Module included in the following assemblies: |
| 2 | +// |
| 3 | +// * nodes/nodes/rosa-managing-worker-nodes.adoc |
| 4 | + |
| 5 | +:_content-type: PROCEDURE |
| 6 | +[id="creating_machine_pools_cli_{context}"] |
| 7 | += Creating a machine pool using the ROSA CLI |
| 8 | + |
| 9 | +You can create additional machine pools for your {product-title} (ROSA) cluster by using the ROSA CLI (`rosa`). |
| 10 | + |
| 11 | +.Prerequisites |
| 12 | + |
| 13 | +* You installed and configured the latest AWS (`aws`), ROSA (`rosa`), and OpenShift (`oc`) CLIs on your workstation. |
| 14 | +* You logged in to your Red Hat account by using the `rosa` CLI. |
| 15 | +* You created a ROSA cluster. |
| 16 | +
|
| 17 | +.Procedure |
| 18 | + |
| 19 | +* 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: |
| 20 | ++ |
| 21 | +[source,terminal] |
| 22 | +---- |
| 23 | +$ rosa create machinepool --cluster=<cluster-name> \ |
| 24 | + --name=<machine_pool_id> \ <1> |
| 25 | + --replicas=<replica_count> \ <2> |
| 26 | + --instance-type=<instance_type> \ <3> |
| 27 | + --labels=<key>=<value>,<key>=<value> \ <4> |
| 28 | + --taints=<key>=<value>:<effect>,<key>=<value>:<effect> \ <5> |
| 29 | + --use-spot-instances \ <6> |
| 30 | + --spot-max-price=0.5 <7> |
| 31 | +---- |
| 32 | +<1> Specifies the name of the machine pool. Replace `<machine_pool_id>` with the name of your machine pool. |
| 33 | +<2> Specifies the number of compute nodes to provision. If you deployed ROSA 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. |
| 34 | +<3> 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. |
| 35 | +<4> 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`. |
| 36 | +<5> 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`. |
| 37 | +<6> Optional: Configures your machine pool to deploy machines as non-guaranteed AWS Spot Instances. For information, see link:https://aws.amazon.com/ec2/spot/[Amazon EC2 Spot Instances] in the AWS documentation. If you select *Use Amazon EC2 Spot Instances* for a machine pool, you cannot disable the option after the machine pool is created. |
| 38 | +<7> Optional: If you have opted to use Spot Instances, you can specify this argument to define a maximum hourly price for a Spot Instance. If this argument is not specified, the on-demand price is used. |
| 39 | ++ |
| 40 | +[IMPORTANT] |
| 41 | +==== |
| 42 | +Your Amazon EC2 Spot Instances might be interrupted at any time. Use Amazon EC2 Spot Instances only for workloads that can tolerate interruptions. |
| 43 | +==== |
| 44 | ++ |
| 45 | +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: |
| 46 | ++ |
| 47 | +[source,terminal] |
| 48 | +---- |
| 49 | +$ rosa create machinepool --cluster=mycluster --name=mymachinepool --replicas=2 --instance-type=m5.xlarge --labels=app=db,tier=backend |
| 50 | +---- |
| 51 | ++ |
| 52 | +.Example output |
| 53 | +[source,terminal] |
| 54 | +---- |
| 55 | +I: Machine pool 'mymachinepool' created successfully on cluster 'mycluster' |
| 56 | +I: To view all machine pools, run 'rosa list machinepools -c mycluster' |
| 57 | +---- |
| 58 | +
|
| 59 | +* To add a machine pool that uses autoscaling, create the machine pool and define the autoscaling configuration, instance type and node labels: |
| 60 | ++ |
| 61 | +[source,terminal] |
| 62 | +---- |
| 63 | +$ rosa create machinepool --cluster=<cluster-name> \ |
| 64 | + --name=<machine_pool_id> \ <1> |
| 65 | + --enable-autoscaling \ <2> |
| 66 | + --min-replicas=<minimum_replica_count> \ <3> |
| 67 | + --max-replicas=<maximum_replica_count> \ <3> |
| 68 | + --instance-type=<instance_type> \ <4> |
| 69 | + --labels=<key>=<value>,<key>=<value> \ <5> |
| 70 | + --taints=<key>=<value>:<effect>,<key>=<value>:<effect> \ <6> |
| 71 | + --use-spot-instances \ <7> |
| 72 | + --spot-max-price=0.5 <8> |
| 73 | +---- |
| 74 | +<1> Specifies the name of the machine pool. Replace `<machine_pool_id>` with the name of your machine pool. |
| 75 | +<2> Enables autoscaling in the machine pool to meet the deployment needs. |
| 76 | +<3> 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 ROSA 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. |
| 77 | +<4> 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. |
| 78 | +<5> 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`. |
| 79 | +<6> 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`. |
| 80 | +<7> Optional: Configures your machine pool to deploy machines as non-guaranteed AWS Spot Instances. For information, see link:https://aws.amazon.com/ec2/spot/[Amazon EC2 Spot Instances] in the AWS documentation. If you select *Use Amazon EC2 Spot Instances* for a machine pool, you cannot disable the option after the machine pool is created. |
| 81 | +<8> Optional: If you have opted to use Spot Instances, you can specify this argument to define a maximum hourly price for a Spot Instance. If this argument is not specified, the on-demand price is used. |
| 82 | ++ |
| 83 | +[IMPORTANT] |
| 84 | +==== |
| 85 | +Your Amazon EC2 Spot Instances might be interrupted at any time. Use Amazon EC2 Spot Instances only for workloads that can tolerate interruptions. |
| 86 | +==== |
| 87 | ++ |
| 88 | +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: |
| 89 | ++ |
| 90 | +[source,terminal] |
| 91 | +---- |
| 92 | +$ rosa create machinepool --cluster=mycluster --name=mymachinepool --enable-autoscaling --min-replicas=3 --max-replicas=6 --instance-type=m5.xlarge --labels=app=db,tier=backend |
| 93 | +---- |
| 94 | ++ |
| 95 | +.Example output |
| 96 | +[source,terminal] |
| 97 | +---- |
| 98 | +I: Machine pool 'mymachinepool' created successfully on cluster 'mycluster' |
| 99 | +I: To view all machine pools, run 'rosa list machinepools -c mycluster' |
| 100 | +---- |
| 101 | +
|
| 102 | +.Verification |
| 103 | + |
| 104 | +. List the available machine pools in your cluster: |
| 105 | ++ |
| 106 | +[source,terminal] |
| 107 | +---- |
| 108 | +$ rosa list machinepools --cluster=<cluster_name> |
| 109 | +---- |
| 110 | ++ |
| 111 | +.Example output |
| 112 | +[source,terminal] |
| 113 | +---- |
| 114 | +ID AUTOSCALING REPLICAS INSTANCE TYPE LABELS TAINTS AVAILABILITY ZONES SPOT INSTANCES |
| 115 | +Default No 3 m5.xlarge us-east-1a, us-east-1b, us-east-1c N/A |
| 116 | +mymachinepool Yes 3-6 m5.xlarge app=db, tier=backend us-east-1a, us-east-1b, us-east-1c No |
| 117 | +---- |
| 118 | + |
| 119 | +. Verify that the machine pool is included in the output and the configuration is as expected. |
0 commit comments