|
| 1 | +// Module included in the following assemblies: |
| 2 | +// |
| 3 | +// * rosa_cluster_admin/rosa_nodes/rosa-managing-worker-nodes.adoc |
| 4 | + |
| 5 | +:_mod-docs-content-type: PROCEDURE |
| 6 | +[id="creating_machine_pools_cli_capres_{context}"] |
| 7 | += Creating a machine pool with Capacity Reservations using the {rosa-cli} |
| 8 | + |
| 9 | +You can create a new machine pool with Capacity Reservations by using the {rosa-cli-first}. Both On-Demand Capacity Reservations and Capacity Blocks for ML are supported. |
| 10 | + |
| 11 | +[NOTE] |
| 12 | +==== |
| 13 | +Currently, upgrading machine pools and enabling autoscaling is not suppored on machine pools with Capacity Reservations. |
| 14 | +==== |
| 15 | + |
| 16 | +.Prerequisites |
| 17 | + |
| 18 | +* You installed and configured the {rosa-cli} version 1.2.57 or above. |
| 19 | +* You logged in to your Red{nbsp}Hat account using the {rosa-cli}. |
| 20 | +* You created a {product-title} cluster version 4.19 or above. |
| 21 | +* The cluster already has a machine pool that is not using a Capacity Reservation or taints. The machine pool must have at least 2 worker nodes. |
| 22 | +* You have a Capacity Reservation ID and capacity is reserved for the instance type required in the Availability Zone (AZ) of the machine pool that you are creating. |
| 23 | +
|
| 24 | +.Procedure |
| 25 | + |
| 26 | +* Create the machine pool and define the instance type, worker node count, and Capacity Reservation ID by running the following command: |
| 27 | ++ |
| 28 | +-- |
| 29 | +[source,terminal] |
| 30 | +---- |
| 31 | +$ rosa create machinepool --cluster=<cluster-name> \ |
| 32 | + --name=<machine_pool_id> \ |
| 33 | + --replicas=<replica_count> \ |
| 34 | + --capacity-reservation-id cr-<capacity_reservation_id> \ |
| 35 | + --instance-type=<instance_type> \ |
| 36 | + --subnet <subnet_id> |
| 37 | +---- |
| 38 | +
|
| 39 | +where: |
| 40 | + |
| 41 | +*<machine_pool_id>*:: Specifies the name of the machine pool. |
| 42 | +*<replica_count>*:: Specifies the number of provisioned compute nodes. If you deploy {product-title} using a single AZ, this defines the number of compute nodes provisioned to the machine pool for the AZ. If you deploy your cluster using multiple AZs, this defines the total number of compute nodes provisioned across all AZs. For multi-zone clusters, the compute node count must be a multiple of 3. The `--replicas` argument is required when autoscaling is not configured. |
| 43 | +*cr-<capacity_reservation_id>*:: Specifies the reservation ID. You get an ID in the `cr-<capacity_reservation_id>` format when you purchase a Capacity Reservation from AWS. The ID can be for both On-Demand Capacity Reservations or Capacity Blocks for ML, you do not need to specify the reservation type. |
| 44 | +*<instance_type>*:: *Optional*: Specifies 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. |
| 45 | +*<subnet_id>*:: *Optional*: Specifies the subnet ID. For Bring Your Own Virtual Private Cloud (BYO VPC) clusters, you can select a subnet to create a single-AZ machine pool. If you select a subnet that was not specified during the initial cluster creation, you must tag the subnet with the `kubernetes.io/cluster/<infra-id>` key and `shared` value. Customers can obtain the Infra ID by running the following command: |
| 46 | ++ |
| 47 | +[source,terminal] |
| 48 | +---- |
| 49 | +$ rosa describe cluster --cluster <cluster_name>|grep "Infra ID:" |
| 50 | +---- |
| 51 | ++ |
| 52 | +.Example output |
| 53 | +[source,terminal] |
| 54 | +---- |
| 55 | +Infra ID: mycluster-xqvj7 |
| 56 | +---- |
| 57 | +-- |
| 58 | + |
| 59 | +.Example |
| 60 | + |
| 61 | +The following example creates a machine pool called `mymachinepool` that uses the `c5.xlarge` instance type and has 1 compute node replica. The example also adds a Capacity Reservation ID. Example input and output: |
| 62 | + |
| 63 | +[source,terminal] |
| 64 | +---- |
| 65 | +$ rosa create machinepool --cluster=mycluster --name=mymachinepool --replicas 1 --capacity-reservation-id <capacity_reservation_id> --subnet <subnet_id> --instance-type c5.xlarge |
| 66 | +---- |
| 67 | + |
| 68 | +[source,terminal] |
| 69 | +---- |
| 70 | +I: Checking available instance types for machine pool 'mymachinepool' |
| 71 | +I: Machine pool 'mymachinepool' created successfully on hosted cluster 'mycluster' |
| 72 | +---- |
| 73 | + |
| 74 | +.Verification |
| 75 | + |
| 76 | +You can list all machine pools on your cluster or describe individual machine pools. |
| 77 | + |
| 78 | +* List the available machine pools on your cluster by running the following command: |
| 79 | ++ |
| 80 | +[source,terminal] |
| 81 | +---- |
| 82 | +$ rosa list machinepools --cluster <cluster_name> |
| 83 | +---- |
| 84 | +
|
| 85 | +* Describe the information of a specific machine pool in your cluster by running the following command. |
| 86 | ++ |
| 87 | +[source,terminal] |
| 88 | +---- |
| 89 | +$ rosa describe machinepool --cluster <cluster_name> --machinepool <machine_pool_name> |
| 90 | +---- |
| 91 | ++ |
| 92 | +.Example output |
| 93 | +[source,terminal] |
| 94 | +---- |
| 95 | +ID: <machine_pool_name> |
| 96 | +Cluster ID: <cluster-id> |
| 97 | +Autoscaling: No |
| 98 | +Desired replicas: 1 |
| 99 | +Current replicas: 1 |
| 100 | +Instance type: c5.xlarge |
| 101 | +Labels: |
| 102 | +Tags: red-hat-managed=true, api.openshift.com/environment=production, api.openshift.com/id=<cluster_name>, api.openshift.com/legal-entity-id=<legal_entity_id>, api.openshift.com/name=<cluster_name>, api.openshift.com/nodepool-hypershift=<cluster_name>-<machine_pool_name>, api.openshift.com/nodepool-ocm=<machine_pool_name>, red-hat-clustertype=rosa |
| 103 | +Taints: |
| 104 | +Availability zone: us-east-1a |
| 105 | +Subnet: <subnet-id> |
| 106 | +Disk Size: 300 GiB |
| 107 | +Version: 4.19.10 |
| 108 | +EC2 Metadata Http Tokens: optional |
| 109 | +Autorepair: Yes |
| 110 | +Tuning configs: |
| 111 | +Kubelet configs: |
| 112 | +Additional security group IDs: |
| 113 | +Node drain grace period: |
| 114 | +Capacity Reservation: |
| 115 | + - ID: <capacity-reservation-id> |
| 116 | + - Type: OnDemand |
| 117 | +Management upgrade: |
| 118 | + - Type: Replace |
| 119 | + - Max surge: 1 |
| 120 | + - Max unavailable: 0 |
| 121 | +Message: Minimum availability requires 1 replicas, current 1 available |
| 122 | +---- |
| 123 | ++ |
| 124 | +The output should include the Capacity Reservation ID and type. |
0 commit comments