Skip to content

Commit 77d228a

Browse files
Merge pull request #265795 from Nickomang/aks-kaarthik-crg
AKS CRG
2 parents 268bc3a + 49b1006 commit 77d228a

File tree

1 file changed

+55
-52
lines changed

1 file changed

+55
-52
lines changed

articles/aks/manage-node-pools.md

Lines changed: 55 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -183,71 +183,74 @@ AKS offers a separate feature to automatically scale node pools with a feature c
183183
184184
For more information, see [use the cluster autoscaler](cluster-autoscaler.md#use-the-cluster-autoscaler-on-multiple-node-pools).
185185
186-
## Associate capacity reservation groups to node pools (preview)
186+
## Associate capacity reservation groups to node pools
187187
188188
As your workload demands change, you can associate existing capacity reservation groups to node pools to guarantee allocated capacity for your node pools.
189189
190-
For more information, see [capacity reservation groups][capacity-reservation-groups].
190+
## Prerequisites to use capacity reservation groups with AKS
191191
192-
### Register preview feature
193-
194-
[!INCLUDE [preview features callout](includes/preview/preview-callout.md)]
195-
196-
1. Install the `aks-preview` extension using the [`az extension add`][az-extension-add] command.
197-
198-
```azurecli-interactive
199-
az extension add --name aks-preview
200-
```
201-
202-
2. Update to the latest version of the extension using the [`az extension update`][az-extension-update] command.
203-
204-
```azurecli-interactive
205-
az extension update --name aks-preview
206-
```
207-
208-
3. Register the `CapacityReservationGroupPreview` feature flag using the [`az feature register`][az-feature-register] command.
209-
210-
```azurecli-interactive
211-
az feature register --namespace "Microsoft.ContainerService" --name "CapacityReservationGroupPreview"
212-
```
213-
214-
It takes a few minutes for the status to show *Registered*.
215-
216-
4. Verify the registration status using the [`az feature show][az-feature-show`] command.
192+
- Use CLI version 2.56 or above and API version 2023-10-01 or higher.
193+
- The capacity reservation group should already exist and should contain minimum one capacity reservation, otherwise the node pool is added to the cluster with a warning and no capacity reservation group gets associated. For more information, see [capacity reservation groups][capacity-reservation-groups].
194+
- You need to create a user-assigned managed identity for the resource group that contains the capacity reservation group (CRG). System-assigned managed identities won't work for this feature. In the following example, replace the environment variables with your own values.
217195
218196
```azurecli-interactive
219-
az feature show --namespace "Microsoft.ContainerService" --name "CapacityReservationGroupPreview"
197+
IDENTITY_NAME=myID
198+
RG_NAME=myResourceGroup
199+
CLUSTER_NAME=myAKSCluster
200+
VM_SKU=Standard_D4s_v3
201+
NODE_COUNT=2
202+
LOCATION=westus2
203+
az identity create --name $IDENTITY_NAME --resource-group $RG_NAME
204+
IDENTITY_ID=$(az identity show --name $IDENTITY_NAME --resource-group $RG_NAME --query identity.id -o tsv)
220205
```
221-
222-
5. When the status reflects *Registered*, refresh the registration of the *Microsoft.ContainerService* resource provider using the [`az provider register`][az-provider-register] command.
223-
206+
- You need to assign the `Contributor` role to the user-assigned identity created above. For more details, see [Steps to assign an Azure role](/azure/role-based-access-control/role-assignments-steps#privileged-administrator-roles).
207+
- Create a new cluster and assign the newly created identity.
224208
```azurecli-interactive
225-
az provider register --namespace Microsoft.ContainerService
209+
az aks create --resource-group $RG_NAME --name $CLUSTER_NAME --location $LOCATION \
210+
--node-vm-size $VM_SKU --node-count $NODE_COUNT \
211+
--assign-identity $IDENTITY_ID --enable-managed-identity
226212
```
227-
228-
### Manage capacity reservations
213+
- You can also assign the user-managed identity on an existing managed cluster with update command.
214+
215+
```azurecli-interactive
216+
az aks update --resource-group $RG_NAME --name $CLUSTER_NAME --location $LOCATION \
217+
--node-vm-size $VM_SKU --node-count $NODE_COUNT \
218+
--assign-identity $IDENTITY_ID --enable-managed-identity
219+
```
220+
221+
### Associate an existing capacity reservation group with a node pool
222+
223+
Associate an existing capacity reservation group with a node pool using the [`az aks nodepool add`][az-aks-nodepool-add] command and specify a capacity reservation group with the `--crg-id` flag. The following example assumes you have a CRG named "myCRG".
224+
225+
```azurecli-interactive
226+
RG_NAME=myResourceGroup
227+
CLUSTER_NAME=myAKSCluster
228+
NODEPOOL_NAME=myNodepool
229+
CRG_NAME=myCRG
230+
CRG_ID=$(az capacity reservation group show --capacity-reservation-group $CRG_NAME --resource-group $RG_NAME --query id -o tsv)
231+
az aks nodepool add --resource-group $RG_NAME --cluster-name $CLUSTER_NAME --name $NODEPOOL_NAME --crg-id $CRG_ID
232+
```
233+
234+
### Associate an existing capacity reservation group with a system node pool
235+
236+
To associate an existing capacity reservation group with a system node pool, associate the cluster with the user-assigned identity with the Contributor role on your CRG and the CRG itself during cluster creation. Use the [`az aks create`][az-aks-create] command with the `--assign-identity` and `--crg-id` flags.
237+
238+
```azurecli-interactive
239+
IDENTITY_NAME=myID
240+
RG_NAME=myResourceGroup
241+
CLUSTER_NAME=myAKSCluster
242+
NODEPOOL_NAME=myNodepool
243+
CRG_NAME=myCRG
244+
CRG_ID=$(az capacity reservation group show --capacity-reservation-group $CRG_NAME --resource-group $RG_NAME --query id -o tsv)
245+
IDENTITY_ID=$(az identity show --name $IDENTITY_NAME --resource-group $RG_NAME --query identity.id -o tsv)
246+
az aks create --resource-group $RG_NAME --cluster-name $CLUSTER_NAME --crg-id $CRG_ID --assign-identity $IDENTITY_ID --enable-managed-identity
247+
```
229248

230249
> [!NOTE]
231-
> The capacity reservation group should already exist, otherwise the node pool is added to the cluster with a warning and no capacity reservation group gets associated.
232-
233-
#### Associate an existing capacity reservation group to a node pool
234-
235-
* Associate an existing capacity reservation group to a node pool using the [`az aks nodepool add`][az-aks-nodepool-add] command and specify a capacity reservation group with the `--capacityReservationGroup` flag.
236-
237-
```azurecli-interactive
238-
az aks nodepool add -g MyRG --cluster-name MyMC -n myAP --capacityReservationGroup myCRG
239-
```
240-
241-
#### Associate an existing capacity reservation group to a system node pool
242-
243-
* Associate an existing capacity reservation group to a system node pool using the [`az aks create`][az-aks-create] command.
244-
245-
```azurecli-interactive
246-
az aks create -g MyRG --cluster-name MyMC --capacityReservationGroup myCRG
247-
```
250+
> Deleting a node pool implicitly dissociates that node pool from any associated capacity reservation group before the node pool is deleted. Deleting a cluster implicitly dissociates all node pools in that cluster from their associated capacity reservation groups.
248251
249252
> [!NOTE]
250-
> Deleting a node pool implicitly dissociates that node pool from any associated capacity reservation group before the node pool is deleted. Deleting a cluster implicitly dissociates all node pools in that cluster from their associated capacity reservation groups.
253+
> You cannot update an existing node pool with a capacity reservation group. The recommended approach is to associate a capacity reservation group during the node pool creation.
251254
252255
## Specify a VM size for a node pool
253256

0 commit comments

Comments
 (0)