|
| 1 | +// Module included in the following assemblies: |
| 2 | +// |
| 3 | +// * machine_management/creating_machinesets/creating-machineset-azure.adoc |
| 4 | +// * machine_management/control_plane_machine_management/cpmso_provider_configurations/cpmso-config-options-azure.adoc |
| 5 | + |
| 6 | +ifeval::["{context}" == "creating-machineset-azure"] |
| 7 | +:azure: |
| 8 | +endif::[] |
| 9 | +ifeval::["{context}" == "cpmso-config-options-azure"] |
| 10 | +:azure: |
| 11 | +endif::[] |
| 12 | +ifeval::["{context}" == "creating-machineset-aws"] |
| 13 | +:aws: |
| 14 | +endif::[] |
| 15 | +ifeval::["{context}" == "cpmso-config-options-aws"] |
| 16 | +:aws: |
| 17 | +endif::[] |
| 18 | + |
| 19 | +:_mod-docs-content-type: PROCEDURE |
| 20 | +[id="machineset-capacity-reservation_{context}"] |
| 21 | +ifdef::azure[= Configuring Capacity Reservation by using machine sets] |
| 22 | +ifdef::aws[= Configuring Capacity Reservations by using machine sets] |
| 23 | + |
| 24 | +{product-title} version {product-version} and later supports |
| 25 | +ifdef::azure[on-demand Capacity Reservation with Capacity Reservation groups on {azure-full} clusters.] |
| 26 | +ifdef::aws[Capacity Reservations on {aws-full} clusters, including On-Demand Capacity Reservations and Capacity Blocks for ML.] |
| 27 | + |
| 28 | +You can configure a machine set to deploy machines on any available resources that match the parameters of a capacity request that you define. |
| 29 | +These parameters specify the |
| 30 | +ifdef::azure[VM size,] |
| 31 | +ifdef::aws[instance type,] |
| 32 | +region, and number of instances that you want to reserve. |
| 33 | +If your |
| 34 | +ifdef::azure[{azure-short} subscription quota] |
| 35 | +ifdef::aws[Capacity Reservation] |
| 36 | +can accommodate the capacity request, the deployment succeeds. |
| 37 | + |
| 38 | +For more information, including limitations and suggested use cases for this |
| 39 | +ifdef::azure[{azure-short} offering, see link:https://learn.microsoft.com/en-us/azure/virtual-machines/capacity-reservation-overview[On-demand Capacity Reservation] in the {azure-full} documentation.] |
| 40 | +ifdef::aws[{aws-short} offering, see link:https://docs.aws.amazon.com/en_us/AWSEC2/latest/UserGuide/capacity-reservation-overview.html[On-Demand Capacity Reservations and Capacity Blocks for ML] in the {aws-short} documentation.] |
| 41 | + |
| 42 | +ifdef::azure[] |
| 43 | +[NOTE] |
| 44 | +==== |
| 45 | +You cannot change an existing Capacity Reservation configuration for a machine set. |
| 46 | +To use a different Capacity Reservation group, you must replace the machine set and the machines that the previous machine set deployed. |
| 47 | +==== |
| 48 | +endif::azure[] |
| 49 | + |
| 50 | +.Prerequisites |
| 51 | + |
| 52 | +* You have access to the cluster with `cluster-admin` privileges. |
| 53 | +* You installed the {oc-first}. |
| 54 | +ifdef::azure[] |
| 55 | +* You created a Capacity Reservation group. |
| 56 | +For more information, see link:https://learn.microsoft.com/en-us/azure/virtual-machines/capacity-reservation-create[Create a Capacity Reservation] in the {azure-full} documentation. |
| 57 | +endif::azure[] |
| 58 | +ifdef::aws[] |
| 59 | +* You purchased an On-Demand Capacity Reservation or Capacity Block for ML. |
| 60 | +For more information, see link:https://docs.aws.amazon.com/en_us/AWSEC2/latest/UserGuide/capacity-reservation-overview.html[On-Demand Capacity Reservations and Capacity Blocks for ML] in the {aws-short} documentation. |
| 61 | +endif::aws[] |
| 62 | +
|
| 63 | +.Procedure |
| 64 | + |
| 65 | +. In a text editor, open the YAML file for an existing machine set or create a new one. |
| 66 | + |
| 67 | +. Edit the following section under the `providerSpec` field: |
| 68 | ++ |
| 69 | +-- |
| 70 | +.Sample configuration |
| 71 | +[source,yaml] |
| 72 | +---- |
| 73 | +tag::compute[] |
| 74 | +apiVersion: machine.openshift.io/v1beta1 |
| 75 | +kind: MachineSet |
| 76 | +end::compute[] |
| 77 | +tag::controlplane[] |
| 78 | +apiVersion: machine.openshift.io/v1 |
| 79 | +kind: ControlPlaneMachineSet |
| 80 | +end::controlplane[] |
| 81 | +# ... |
| 82 | +spec: |
| 83 | + template: |
| 84 | +tag::compute[] |
| 85 | + spec: |
| 86 | + providerSpec: |
| 87 | + value: |
| 88 | +ifdef::azure[] |
| 89 | + capacityReservationGroupID: <capacity_reservation_group> # <1> |
| 90 | +endif::azure[] |
| 91 | +ifdef::aws[] |
| 92 | + capacityReservationId: <capacity_reservation> # <1> |
| 93 | + marketType: <market_type> # <2> |
| 94 | +endif::aws[] |
| 95 | +end::compute[] |
| 96 | +tag::controlplane[] |
| 97 | + machines_v1beta1_machine_openshift_io: |
| 98 | + spec: |
| 99 | + providerSpec: |
| 100 | + value: |
| 101 | +ifdef::azure[] |
| 102 | + capacityReservationGroupID: <capacity_reservation_group> # <1> |
| 103 | +endif::azure[] |
| 104 | +ifdef::aws[] |
| 105 | + capacityReservationId: <capacity_reservation> # <1> |
| 106 | + marketType: <market_type> # <2> |
| 107 | +endif::aws[] |
| 108 | +end::controlplane[] |
| 109 | +# ... |
| 110 | +---- |
| 111 | +<1> Specify the ID of the |
| 112 | +ifdef::azure[Capacity Reservation group] |
| 113 | +ifdef::aws[Capacity Block for ML or On-Demand Capacity Reservation] |
| 114 | +that you want the machine set to deploy machines on. |
| 115 | +ifdef::aws[] |
| 116 | +<2> Specify the market type to use. |
| 117 | +The following values are valid: |
| 118 | +`CapacityBlock`:: Use this market type with Capacity Blocks for ML. |
| 119 | +`OnDemand`:: Use this market type with On-Demand Capacity Reservations. |
| 120 | +tag::compute[] |
| 121 | +`Spot`:: Use this market type with Spot Instances. |
| 122 | +This option is not compatible with Capacity Reservations. |
| 123 | +end::compute[] |
| 124 | +endif::[] |
| 125 | +-- |
| 126 | + |
| 127 | +.Verification |
| 128 | + |
| 129 | +* To verify machine deployment, list the machines that the machine set created by running the following command: |
| 130 | ++ |
| 131 | +[source,terminal] |
| 132 | +---- |
| 133 | +tag::compute[] |
| 134 | +$ oc get machines.machine.openshift.io \ |
| 135 | + -n openshift-machine-api \ |
| 136 | + -l machine.openshift.io/cluster-api-machineset=<machine_set_name> |
| 137 | +end::compute[] |
| 138 | +tag::controlplane[] |
| 139 | +$ oc get machine \ |
| 140 | + -n openshift-machine-api \ |
| 141 | + -l machine.openshift.io/cluster-api-machine-role=master |
| 142 | +end::controlplane[] |
| 143 | +---- |
| 144 | +tag::compute[] |
| 145 | ++ |
| 146 | +where `<machine_set_name>` is the name of the compute machine set. |
| 147 | +end::compute[] |
| 148 | ++ |
| 149 | +In the output, verify that the characteristics of the listed machines match the parameters of your |
| 150 | +ifdef::azure[Capacity Reservation.] |
| 151 | +ifdef::aws[Capacity Reservation.] |
| 152 | +
|
| 153 | +ifeval::["{context}" == "creating-machineset-azure"] |
| 154 | +:!azure: |
| 155 | +endif::[] |
| 156 | +ifeval::["{context}" == "cpmso-config-options-azure"] |
| 157 | +:!azure: |
| 158 | +endif::[] |
| 159 | +ifeval::["{context}" == "creating-machineset-aws"] |
| 160 | +:!aws: |
| 161 | +endif::[] |
| 162 | +ifeval::["{context}" == "cpmso-config-options-aws"] |
| 163 | +:!aws: |
| 164 | +endif::[] |
0 commit comments