Skip to content

Commit 76ea224

Browse files
committed
Updated commands based on customer feedback
1 parent 5ac386e commit 76ea224

File tree

1 file changed

+26
-20
lines changed

1 file changed

+26
-20
lines changed

articles/aks/configure-azure-cni-dynamic-ip-allocation.md

Lines changed: 26 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ This article shows you how to use Azure CNI networking for dynamic allocation of
3737
* If you have an existing cluster, you need to enable Container Insights for monitoring IP subnet usage. You can enable Container Insights using the [`az aks enable-addons`][az-aks-enable-addons] command, as shown in the following example:
3838

3939
```azurecli-interactive
40-
az aks enable-addons --addons monitoring --name <cluster-name> --resource-group <resource-group-name>
40+
az aks enable-addons --addons monitoring --name $CLUSTER_NAME --resource-group $RESOURCE_GROUP_NAME
4141
```
4242
4343
## Plan IP addressing
@@ -73,31 +73,33 @@ Using dynamic allocation of IPs and enhanced subnet support in your cluster is s
7373
Create the virtual network with two subnets.
7474
7575
```azurecli-interactive
76-
resourceGroup="myResourceGroup"
77-
vnet="myVirtualNetwork"
78-
location="westcentralus"
76+
RESOURCE_GROUP_NAME="myResourceGroup"
77+
VNET_NAME="myVirtualNetwork"
78+
LOCATION="westcentralus"
79+
SUBNET_NAME_1="nodesubnet"
80+
SUBNET_NAME_2="podsubnet"
7981
8082
# Create the resource group
81-
az group create --name $resourceGroup --location $location
83+
az group create --name $RESOURCE_GROUP_NAME --location $LOCATION
8284
8385
# Create our two subnet network
84-
az network vnet create -resource-group $resourceGroup --location $location --name $vnet --address-prefixes 10.0.0.0/8 -o none
85-
az network vnet subnet create --resource-group $resourceGroup --vnet-name $vnet --name nodesubnet --address-prefixes 10.240.0.0/16 -o none
86-
az network vnet subnet create --resource-group $resourceGroup --vnet-name $vnet --name podsubnet --address-prefixes 10.241.0.0/16 -o none
86+
az network vnet create --resource-group $RESOURCE_GROUP_NAME --location $LOCATION --name $VNET_NAME --address-prefixes 10.0.0.0/8 -o none
87+
az network vnet subnet create --resource-group $RESOURCE_GROUP_NAME --vnet-name $VNET_NAME --name $SUBNET_NAME_1 --address-prefixes 10.240.0.0/16 -o none
88+
az network vnet subnet create --resource-group $RESOURCE_GROUP_NAME --vnet-name $VNET_NAME --name $SUBNET_NAME_2 --address-prefixes 10.241.0.0/16 -o none
8789
```
8890

8991
Create the cluster, referencing the node subnet using `--vnet-subnet-id` and the pod subnet using `--pod-subnet-id` and enabling the monitoring add-on.
9092

9193
```azurecli-interactive
92-
clusterName="myAKSCluster"
93-
subscription="aaaaaaa-aaaaa-aaaaaa-aaaa"
94+
CLUSTER_NAME="myAKSCluster"
95+
SUBSCRIPTION="aaaaaaa-aaaaa-aaaaaa-aaaa"
9496
95-
az aks create --name $clusterName --resource-group $resourceGroup --location $location \
97+
az aks create --name $CLUSTER_NAME --resource-group $RESOURCE_GROUP_NAME --location $LOCATION \
9698
--max-pods 250 \
9799
--node-count 2 \
98100
--network-plugin azure \
99-
--vnet-subnet-id /subscriptions/$subscription/resourceGroups/$resourceGroup/providers/Microsoft.Network/virtualNetworks/$vnet/subnets/nodesubnet \
100-
--pod-subnet-id /subscriptions/$subscription/resourceGroups/$resourceGroup/providers/Microsoft.Network/virtualNetworks/$vnet/subnets/podsubnet \
101+
--vnet-subnet-id /subscriptions/$SUBSCRIPTION/resourceGroups/$RESOURCE_GROUP_NAME/providers/Microsoft.Network/virtualNetworks/$VNET_NAME/subnets/$SUBNET_NAME_1 \
102+
--pod-subnet-id /subscriptions/$SUBSCRIPTION/resourceGroups/$RESOURCE_GROUP_NAME/providers/Microsoft.Network/virtualNetworks/$VNET_NAME/subnets/$SUBNET_NAME_2 \
101103
--enable-addons monitoring
102104
```
103105

@@ -106,14 +108,18 @@ az aks create --name $clusterName --resource-group $resourceGroup --location $lo
106108
When adding node pool, reference the node subnet using `--vnet-subnet-id` and the pod subnet using `--pod-subnet-id`. The following example creates two new subnets that are then referenced in the creation of a new node pool:
107109

108110
```azurecli-interactive
109-
az network vnet subnet create -g $resourceGroup --vnet-name $vnet --name node2subnet --address-prefixes 10.242.0.0/16 -o none
110-
az network vnet subnet create -g $resourceGroup --vnet-name $vnet --name pod2subnet --address-prefixes 10.243.0.0/16 -o none
111+
SUBNET_NAME_3="node2subnet"
112+
SUBNET_NAME_4="pod2subnet"
113+
NODE_POOL_NAME="mynodepool"
111114
112-
az aks nodepool add --cluster-name $clusterName -g $resourceGroup -n newnodepool \
115+
az network vnet subnet create --resource-group $RESOURCE_GROUP_NAME --vnet-name $VNET_NAME --name $SUBNET_NAME_3 --address-prefixes 10.242.0.0/16 -o none
116+
az network vnet subnet create --resource-group $RESOURCE_GROUP_NAME --vnet-name $VNET_NAME --name $SUBNET_NAME_4 --address-prefixes 10.243.0.0/16 -o none
117+
118+
az aks nodepool add --cluster-name $CLUSTER_NAME --resource-group $RESOURCE_GROUP_NAME --name $NODE_POOL_NAME \
113119
--max-pods 250 \
114120
--node-count 2 \
115-
--vnet-subnet-id /subscriptions/$subscription/resourceGroups/$resourceGroup/providers/Microsoft.Network/virtualNetworks/$vnet/subnets/node2subnet \
116-
--pod-subnet-id /subscriptions/$subscription/resourceGroups/$resourceGroup/providers/Microsoft.Network/virtualNetworks/$vnet/subnets/pod2subnet \
121+
--vnet-subnet-id /subscriptions/$SUBSCRIPTION/resourceGroups/$RESOURCE_GROUP_NAME/providers/Microsoft.Network/virtualNetworks/$VNET_NAME/subnets/$SUBNET_NAME_3 \
122+
--pod-subnet-id /subscriptions/$SUBSCRIPTION/resourceGroups/$RESOURCE_GROUP_NAME/providers/Microsoft.Network/virtualNetworks/$VNET_NAME/subnets/$SUBNET_NAME_4 \
117123
--no-wait
118124
```
119125

@@ -134,8 +140,8 @@ Azure CNI provides the capability to monitor IP subnet usage. To enable IP subne
134140
Set the variables for subscription, resource group and cluster. Consider the following as examples:
135141

136142
```azurecli-interactive
137-
az account set -s $subscription
138-
az aks get-credentials -n $clusterName -g $resourceGroup
143+
az account set --subscription $SUBSCRIPTION
144+
az aks get-credentials --name $CLUSTER_NAME --resource-group $RESOURCE_GROUP_NAME
139145
```
140146

141147
### Apply the config

0 commit comments

Comments
 (0)