You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: articles/aks/limit-egress-traffic.md
+11-41Lines changed: 11 additions & 41 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,7 +4,7 @@ description: Learn what ports and addresses are required to control egress traff
4
4
services: container-service
5
5
ms.topic: article
6
6
ms.author: jpalma
7
-
ms.date: 06/15/2022
7
+
ms.date: 06/27/2022
8
8
author: palma21
9
9
10
10
#Customer intent: As an cluster operator, I want to restrict egress traffic for nodes to only access defined ports and addresses and improve cluster security.
@@ -442,40 +442,7 @@ Now an AKS cluster can be deployed into the existing virtual network. We'll also
### Create a service principal with access to provision inside the existing virtual network
446
-
447
-
A cluster identity (managed identity or service principal) is used by AKS to create cluster resources. A service principal that is passed at create time is used to create underlying AKS resources such as Storage resources, IPs, and Load Balancers used by AKS (you may also use a [managed identity](use-managed-identity.md) instead). If not granted the appropriate permissions below, you won't be able to provision the AKS Cluster.
448
-
449
-
```azurecli
450
-
# Create SP and Assign Permission to Virtual Network
451
-
452
-
az ad sp create-for-rbac -n "${PREFIX}sp"
453
-
```
454
-
455
-
Now replace the `APPID` and `PASSWORD` below with the service principal appid and service principal password autogenerated by the previous command output. We'll reference the VNET resource ID to grant the permissions to the service principal so AKS can deploy resources into it.
456
-
457
-
```azurecli
458
-
APPID="<SERVICE_PRINCIPAL_APPID_GOES_HERE>"
459
-
PASSWORD="<SERVICEPRINCIPAL_PASSWORD_GOES_HERE>"
460
-
VNETID=$(az network vnet show -g $RG --name $VNET_NAME --query id -o tsv)
461
-
462
-
# Assign SP Permission to VNET
463
-
464
-
az role assignment create --assignee $APPID --scope $VNETID --role "Network Contributor"
465
-
```
466
-
467
-
You can check the detailed permissions that are required [here](kubernetes-service-principal.md#delegate-access-to-other-azure-resources).
468
-
469
-
> [!NOTE]
470
-
> If you're using the kubenet network plugin, you'll need to give the AKS service principal or managed identity permissions to the pre-created route table, since kubenet requires a route table to add neccesary routing rules.
471
-
> ```azurecli-interactive
472
-
> RTID=$(az network route-table show -g $RG -n $FWROUTE_TABLE_NAME --query id -o tsv)
473
-
> az role assignment create --assignee $APPID --scope $RTID --role "Network Contributor"
474
-
> ```
475
-
476
-
### Deploy AKS
477
-
478
-
Finally, the AKS cluster can be deployed into the existing subnet we've dedicated for the cluster. The target subnet to be deployed into is defined with the environment variable, `$SUBNETID`. We didn't define the `$SUBNETID` variable in the previous steps. To set the value for the subnet ID, you can use the following command:
445
+
The target subnet to be deployed into is defined with the environment variable, `$SUBNETID`. We didn't define the `$SUBNETID` variable in the previous steps. To set the value for the subnet ID, you can use the following command:
479
446
480
447
```azurecli
481
448
SUBNETID=$(az network vnet subnet show -g $RG --vnet-name $VNET_NAME --name $AKSSUBNET_NAME --query id -o tsv)
@@ -493,18 +460,19 @@ You'll define the outbound type to use the UDR that already exists on the subnet
493
460
494
461
```azurecli
495
462
az aks create -g $RG -n $AKSNAME -l $LOC \
496
-
--node-count 3 --generate-ssh-keys \
463
+
--node-count 3 \
497
464
--network-plugin $PLUGIN \
498
465
--outbound-type userDefinedRouting \
499
-
--service-cidr 10.41.0.0/16 \
500
-
--dns-service-ip 10.41.0.10 \
501
-
--docker-bridge-address 172.17.0.1/16 \
502
466
--vnet-subnet-id $SUBNETID \
503
-
--service-principal $APPID \
504
-
--client-secret $PASSWORD \
505
467
--api-server-authorized-ip-ranges $FWPUBLIC_IP
506
468
```
507
469
470
+
> [!NOTE]
471
+
> For creating and using your own VNet and route table where the resources are outside of the worker node resource group, the CLI will add the role assignment automatically. If you are using an ARM template or other client, you need to use the Principal ID of the cluster managed identity to perform a [role assignment.][add role to identity]
472
+
>
473
+
> If you are not using the CLI but using your own VNet or route table which are outside of the worker node resource group, it's recommended to use [user-assigned control plane identity][Bring your own control plane managed identity]. For system-assigned control plane identity, we cannot get the identity ID before creating cluster, which causes delay for role assignment to take effect.
474
+
475
+
508
476
### Enable developer access to the API server
509
477
510
478
If you used authorized IP ranges for the cluster on the previous step, you must add your developer tooling IP addresses to the AKS cluster list of approved IP ranges in order to access the API server from there. Another option is to configure a jumpbox with the needed tooling inside a separate subnet in the Firewall's virtual network.
@@ -827,3 +795,5 @@ If you want to restrict how pods communicate between themselves and East-West tr
827
795
[aks-support-policies]: support-policies.md
828
796
[aks-faq]: faq.md
829
797
[aks-private-clusters]: private-clusters.md
798
+
[add role to identity]: use-managed-identity.md#add-role-assignment-for-control-plane-identity
799
+
[Bring your own control plane managed identity]: use-managed-identity.md#bring-your-own-control-plane-managed-identity
0 commit comments