Skip to content

Commit 0d9e0b0

Browse files
authored
Update use-network-policies.md
1 parent 82a5492 commit 0d9e0b0

File tree

1 file changed

+6
-24
lines changed

1 file changed

+6
-24
lines changed

articles/aks/use-network-policies.md

Lines changed: 6 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -60,48 +60,31 @@ First, let's create an AKS cluster that supports network policy.
6060
>
6161
> The network policy feature can only be enabled when the cluster is created. You can't enable network policy on an existing AKS cluster.
6262
63-
To use Azure Network Policy, you must use the [Azure CNI plug-in][azure-cni] and define your own virtual network and subnets. For more detailed information on how to plan out the required subnet ranges, see [configure advanced networking][use-advanced-networking]. Calico Network Policy could be used with either this same Azure CNI plug-in or with the Kubenet CNI plug-in.
63+
To use Azure Network Policy, you must use the [Azure CNI plug-in][azure-cni]. Calico Network Policy could be used with either this same Azure CNI plug-in or with the Kubenet CNI plug-in.
6464

6565
The following example script:
6666

67-
* Creates a virtual network and subnet.
68-
* Creates an AKS cluster in the defined virtual network with system-assigned identity and enables network policy.
67+
* Creates an AKS cluster with system-assigned identity and enables network policy.
6968
* The _Azure Network_ policy option is used. To use Calico as the network policy option instead, use the `--network-policy calico` parameter. Note: Calico could be used with either `--network-plugin azure` or `--network-plugin kubenet`.
7069

7170
Note that instead of using a system-assigned identity, you can also use a user-assigned identity. For more information, see [Use managed identities](use-managed-identity.md).
7271

72+
### Create an AKS cluster for Azure network policies
73+
7374
You can replace the *RESOURCE_GROUP_NAME* and *CLUSTER_NAME* variables:
7475

7576
```azurecli-interactive
7677
RESOURCE_GROUP_NAME=myResourceGroup-NP
7778
CLUSTER_NAME=myAKSCluster
7879
LOCATION=canadaeast
7980
80-
# Create a resource group
81-
az group create --name $RESOURCE_GROUP_NAME --location $LOCATION
82-
83-
# Create a virtual network and subnet
84-
az network vnet create \
85-
--resource-group $RESOURCE_GROUP_NAME \
86-
--name myVnet \
87-
--address-prefixes 10.0.0.0/8 \
88-
--subnet-name myAKSSubnet \
89-
--subnet-prefix 10.240.0.0/16
90-
91-
# Get the virtual network subnet resource ID
92-
SUBNET_ID=$(az network vnet subnet show --resource-group $RESOURCE_GROUP_NAME --vnet-name myVnet --name myAKSSubnet --query id -o tsv)
93-
```
94-
95-
### Create an AKS cluster for Azure network policies
96-
97-
Create the AKS cluster and specify the virtual network and *azure* for the network plugin and network policy.
81+
Create the AKS cluster and specify *azure* for the network plugin and network policy.
9882
9983
```azurecli
10084
az aks create \
10185
--resource-group $RESOURCE_GROUP_NAME \
10286
--name $CLUSTER_NAME \
10387
--node-count 1 \
104-
--vnet-subnet-id $SUBNET_ID \
10588
--network-plugin azure \
10689
--network-policy azure
10790
```
@@ -114,7 +97,7 @@ az aks get-credentials --resource-group $RESOURCE_GROUP_NAME --name $CLUSTER_NAM
11497

11598
### Create an AKS cluster for Calico network policies
11699

117-
Create the AKS cluster and specify the virtual network, *azure* for the network plugin, and *calico* for the network policy. Using *calico* as the network policy enables Calico networking on both Linux and Windows node pools.
100+
Create the AKS cluster and specify *azure* for the network plugin, and *calico* for the network policy. Using *calico* as the network policy enables Calico networking on both Linux and Windows node pools.
118101

119102
If you plan on adding Windows node pools to your cluster, include the `windows-admin-username` and `windows-admin-password` parameters with that meet the [Windows Server password requirements][windows-server-password]. To use Calico with Windows node pools, you also need to register the `Microsoft.ContainerService/EnableAKSWindowsCalico`.
120103

@@ -156,7 +139,6 @@ az aks create \
156139
--resource-group $RESOURCE_GROUP_NAME \
157140
--name $CLUSTER_NAME \
158141
--node-count 1 \
159-
--vnet-subnet-id $SUBNET_ID \
160142
--windows-admin-username $WINDOWS_USERNAME \
161143
--network-plugin azure \
162144
--network-policy calico

0 commit comments

Comments
 (0)