| 
 | 1 | +// Module included in the following assemblies:  | 
 | 2 | +// hosted_control_planes/hcp-manage/hcp-manage-aws.adoc  | 
 | 3 | + | 
 | 4 | +:_mod-docs-content-type: PROCEDURE  | 
 | 5 | +[id="hcp-np-capacity-blocks_{context}"]  | 
 | 6 | += Configuring node pool capacity blocks on {aws-short}  | 
 | 7 | + | 
 | 8 | +After creating a hosted cluster, you can configure node pool capacity blocks for graphics processing unit (GPU) reservations on {aws-first}.  | 
 | 9 | + | 
 | 10 | +.Procedure  | 
 | 11 | + | 
 | 12 | +. Create GPU reservations on {aws-short} by running the following command:  | 
 | 13 | ++  | 
 | 14 | +[IMPORTANT]  | 
 | 15 | +====  | 
 | 16 | +The zone of the GPU reservation must match your hosted cluster zone.  | 
 | 17 | +====  | 
 | 18 | ++  | 
 | 19 | +[source,terminal]  | 
 | 20 | +----  | 
 | 21 | +$ aws ec2 describe-capacity-block-offerings \  | 
 | 22 | +      --instance-type "p4d.24xlarge"\ #<1>  | 
 | 23 | +      --instance-count  "1" \ #<2>  | 
 | 24 | +      --start-date-range "$(date -u +"%Y-%m-%dT%H:%M:%SZ")"  \ #<3>  | 
 | 25 | +      --end-date-range "$(date -u -d "2 day" +"%Y-%m-%dT%H:%M:%SZ")" \ #<4>  | 
 | 26 | +      --capacity-duration-hours 24 \ #<5>  | 
 | 27 | +      --output json  | 
 | 28 | +----  | 
 | 29 | +<1> Defines the type of your {aws-short} instance, for example, `p4d.24xlarge`.  | 
 | 30 | +<2> Defines your instance purchase quantity, for example, `1`. Valid values are integers ranging from `1` to `64`.  | 
 | 31 | +<3> Defines the start date range, for example, `2025-07-21T10:14:39Z`.  | 
 | 32 | +<4> Defines the end date range, for example, `2025-07-22T10:16:36Z`.  | 
 | 33 | +<5> Defines the duration of capacity blocks in hours, for example, `24`.  | 
 | 34 | + | 
 | 35 | +. Purchase the minimum fee capacity block by running the following command:  | 
 | 36 | ++  | 
 | 37 | +[source,terminal]  | 
 | 38 | +----  | 
 | 39 | +$ aws ec2 purchase-capacity-block \  | 
 | 40 | +      --capacity-block-offering-id "${MIN_FEE_ID}" \ #<1>  | 
 | 41 | +      --instance-platform "Linux/UNIX"\ #<2>  | 
 | 42 | +      --tag-specifications 'ResourceType=capacity-reservation,Tags=[{Key=usage-cluster-type,Value=hypershift-hosted}]' \ #<3>  | 
 | 43 | +      --output json   > "${CR_OUTPUT_FILE}"  | 
 | 44 | +----  | 
 | 45 | +<1> Defines the ID of the capacity block offering.  | 
 | 46 | +<2> Defines the platform of your instance.  | 
 | 47 | +<3> Defines the tag for your instance.  | 
 | 48 | + | 
 | 49 | +. Create an environment variable to set the capacity reservation ID by running the following command:  | 
 | 50 | ++  | 
 | 51 | +[source,terminal]  | 
 | 52 | +----  | 
 | 53 | +$ CB_RESERVATION_ID=$(jq -r '.CapacityReservation.CapacityReservationId' "${CR_OUTPUT_FILE}")  | 
 | 54 | +----  | 
 | 55 | ++  | 
 | 56 | +Wait for a couple of minutes for the GPU reservation to become available.  | 
 | 57 | + | 
 | 58 | +. Add a node pool to use the GPU reservation by running the following command:  | 
 | 59 | ++  | 
 | 60 | +[source,terminal]  | 
 | 61 | +----  | 
 | 62 | +$ hcp create nodepool aws \  | 
 | 63 | +  --cluster-name <hosted_cluster_name> \ #<1>  | 
 | 64 | +  --name <node_pool_name> \ #<2>  | 
 | 65 | +  --node-count 1 \ #<3>  | 
 | 66 | +  --instance-type p4d.24xlarge \ #<4>  | 
 | 67 | +  --arch amd64 \ #<5>  | 
 | 68 | +  --release-image <release_image> \ #<6>  | 
 | 69 | +  --render > /tmp/np.yaml  | 
 | 70 | +----  | 
 | 71 | +<1> Replace `<hosted_cluster_name>` with the name of your hosted cluster.  | 
 | 72 | +<2> Replace `<node_pool_name>` with the name of your node pool.  | 
 | 73 | +<3> Defines the node pool count, for example, `1`.  | 
 | 74 | +<4> Defines the instance type, for example, `p4d.24xlarge`.  | 
 | 75 | +<5> Defines an architecture type, for example, `amd64`.  | 
 | 76 | +<6> Replace `<release_image>` with the release image you want to use.  | 
 | 77 | + | 
 | 78 | +. Add the `capacityReservation` setting in your `NodePool` resource by using the following example configuration:  | 
 | 79 | ++  | 
 | 80 | +[source,yaml]  | 
 | 81 | +----  | 
 | 82 | +# ...  | 
 | 83 | +spec:  | 
 | 84 | +  arch: amd64  | 
 | 85 | +  clusterName: cb-np-hcp  | 
 | 86 | +  management:  | 
 | 87 | +    autoRepair: false  | 
 | 88 | +    upgradeType: Replace  | 
 | 89 | +  platform:  | 
 | 90 | +    aws:  | 
 | 91 | +      instanceProfile: cb-np-hcp-dqppw-worker  | 
 | 92 | +      instanceType: p4d.24xlarge  | 
 | 93 | +      rootVolume:  | 
 | 94 | +        size: 120  | 
 | 95 | +        type: gp3  | 
 | 96 | +      subnet:  | 
 | 97 | +        id: subnet-00000  | 
 | 98 | +      placement:  | 
 | 99 | +        capacityReservation:  | 
 | 100 | +          id: ${CB_RESERVATION_ID}  | 
 | 101 | +          marketType: CapacityBlocks  | 
 | 102 | +    type: AWS  | 
 | 103 | +# ...  | 
 | 104 | +----  | 
 | 105 | + | 
 | 106 | +. Apply the node pool configuration by running the following command:  | 
 | 107 | ++  | 
 | 108 | +[source,terminal]  | 
 | 109 | +----  | 
 | 110 | +$ oc apply -f /tmp/np.yaml  | 
 | 111 | +----  | 
 | 112 | + | 
 | 113 | +.Verification  | 
 | 114 | + | 
 | 115 | +. Verify that your new node pool is created successfully by running the following command:  | 
 | 116 | ++  | 
 | 117 | +[source,terminal]  | 
 | 118 | +----  | 
 | 119 | +$ oc get np -n clusters  | 
 | 120 | +----  | 
 | 121 | ++  | 
 | 122 | +.Example output  | 
 | 123 | +[source,terminal]  | 
 | 124 | +----  | 
 | 125 | +NAMESPACE   NAME    CLUSTER     DESIRED NODES   CURRENT  NODES   AUTOSCALING     AUTOREPAIR   VERSION                               UPDATINGVERSION   UPDATINGCONFIG   MESSAGE  | 
 | 126 | +clusters    cb-np   cb-np-hcp   1               1                False           False        4.20.0-0.nightly-2025-06-05-224220    False             False  | 
 | 127 | +----  | 
 | 128 | + | 
 | 129 | +. Verify that your new compute nodes are created in the hosted cluster by running the following command:  | 
 | 130 | ++  | 
 | 131 | +[source,terminal]  | 
 | 132 | +----  | 
 | 133 | +$ oc get nodes  | 
 | 134 | +----  | 
 | 135 | ++  | 
 | 136 | +.Example output  | 
 | 137 | +[source, terminal]  | 
 | 138 | +----  | 
 | 139 | +NAME                           STATUS   ROLES    AGE    VERSION  | 
 | 140 | +ip-10-0-132-74.ec2.internal    Ready    worker   17m    v1.32.5  | 
 | 141 | +ip-10-0-134-183.ec2.internal   Ready    worker   4h5m   v1.32.5  | 
 | 142 | +----  | 
0 commit comments