Skip to content

Commit 9651a57

Browse files
authored
Merge pull request #203754 from CocoWang-wql/patch-5
update the doc
2 parents 7d28b35 + ff07f91 commit 9651a57

File tree

1 file changed

+81
-3
lines changed

1 file changed

+81
-3
lines changed

articles/aks/limit-egress-traffic.md

Lines changed: 81 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ description: Learn what ports and addresses are required to control egress traff
44
services: container-service
55
ms.topic: article
66
ms.author: jpalma
7-
ms.date: 06/27/2022
7+
ms.date: 07/05/2022
88
author: palma21
99

1010
#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.
@@ -458,6 +458,13 @@ You'll define the outbound type to use the UDR that already exists on the subnet
458458
>
459459
> The AKS feature for [**API server authorized IP ranges**](api-server-authorized-ip-ranges.md) can be added to limit API server access to only the firewall's public endpoint. The authorized IP ranges feature is denoted in the diagram as optional. When enabling the authorized IP range feature to limit API server access, your developer tools must use a jumpbox from the firewall's virtual network or you must add all developer endpoints to the authorized IP range.
460460
461+
#### Create an AKS cluster with system-assigned identities
462+
463+
> [!NOTE]
464+
> AKS will create a system-assigned kubelet identity in the Node resource group if you do not [specify your own kubelet managed identity][Use a pre-created kubelet managed identity].
465+
466+
You can create an AKS cluster using a system-assigned managed identity by running the following CLI command.
467+
461468
```azurecli
462469
az aks create -g $RG -n $AKSNAME -l $LOC \
463470
--node-count 3 \
@@ -470,8 +477,76 @@ az aks create -g $RG -n $AKSNAME -l $LOC \
470477
> [!NOTE]
471478
> 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]
472479
>
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.
480+
> 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][Create an AKS cluster with user-assigned identities]. For system-assigned control plane identity, we cannot get the identity ID before creating cluster, which causes delay for role assignment to take effect.
474481
482+
#### Create an AKS cluster with user-assigned identities
483+
484+
##### Create user-assigned managed identities
485+
486+
If you don't have a control plane managed identity, you can create by running the following [az identity create][az-identity-create] command:
487+
488+
```azurecli-interactive
489+
az identity create --name myIdentity --resource-group myResourceGroup
490+
```
491+
492+
The output should resemble the following:
493+
494+
```output
495+
{
496+
"clientId": "<client-id>",
497+
"clientSecretUrl": "<clientSecretUrl>",
498+
"id": "/subscriptions/<subscriptionid>/resourcegroups/myResourceGroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/myIdentity",
499+
"location": "westus2",
500+
"name": "myIdentity",
501+
"principalId": "<principal-id>",
502+
"resourceGroup": "myResourceGroup",
503+
"tags": {},
504+
"tenantId": "<tenant-id>",
505+
"type": "Microsoft.ManagedIdentity/userAssignedIdentities"
506+
}
507+
```
508+
509+
If you don't have a kubelet managed identity, you can create one by running the following [az identity create][az-identity-create] command:
510+
511+
```azurecli-interactive
512+
az identity create --name myKubeletIdentity --resource-group myResourceGroup
513+
```
514+
515+
The output should resemble the following:
516+
517+
```output
518+
{
519+
"clientId": "<client-id>",
520+
"clientSecretUrl": "<clientSecretUrl>",
521+
"id": "/subscriptions/<subscriptionid>/resourcegroups/myResourceGroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/myKubeletIdentity",
522+
"location": "westus2",
523+
"name": "myKubeletIdentity",
524+
"principalId": "<principal-id>",
525+
"resourceGroup": "myResourceGroup",
526+
"tags": {},
527+
"tenantId": "<tenant-id>",
528+
"type": "Microsoft.ManagedIdentity/userAssignedIdentities"
529+
}
530+
```
531+
532+
##### Create an AKS cluster with user-assigned identities
533+
534+
Now you can use the following command to create your AKS cluster with your existing identities in the subnet. Provide the control plane identity resource ID via `assign-identity` and the kubelet managed identity via `assign-kubelet-identity`:
535+
536+
```azurecli
537+
az aks create -g $RG -n $AKSNAME -l $LOC \
538+
--node-count 3 \
539+
--network-plugin $PLUGIN \
540+
--outbound-type userDefinedRouting \
541+
--vnet-subnet-id $SUBNETID \
542+
--api-server-authorized-ip-ranges $FWPUBLIC_IP
543+
--enable-managed-identity \
544+
--assign-identity <identity-resource-id> \
545+
--assign-kubelet-identity <kubelet-identity-resource-id>
546+
```
547+
548+
> [!NOTE]
549+
> 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]
475550
476551
### Enable developer access to the API server
477552

@@ -796,4 +871,7 @@ If you want to restrict how pods communicate between themselves and East-West tr
796871
[aks-faq]: faq.md
797872
[aks-private-clusters]: private-clusters.md
798873
[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
874+
[Create an AKS cluster with user-assigned identities]: limit-egress-traffic.md#create-an-aks-cluster-with-user-assigned-identities
875+
[Use a pre-created kubelet managed identity]: use-managed-identity.md#use-a-pre-created-kubelet-managed-identity
876+
[az-identity-create]: /cli/azure/identity#az_identity_create
877+
[az-aks-get-credentials]: /cli/azure/aks#az_aks_get_credentials

0 commit comments

Comments
 (0)