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
When you're using Microsoft Azure Container Registry together with Azure Kubernetes Service (AKS), an authentication mechanism must be established. You can set up the AKS to Container Registry integration by using a few simple Azure CLI or Azure PowerShell commands. This integration assigns the [AcrPull role](/azure/role-based-access-control/built-in-roles#acrpull) for the kubelet identity that's associated with the AKS cluster to pull images from a container registry.
15
+
When you're using Microsoft Azure Container Registry together with Azure Kubernetes Service (AKS), an authentication mechanism must be established. You can set up the AKS to Container Registry integration by using a few simple Azure CLI or Azure PowerShell commands. This integration assigns either the [Container Registry Repository Reader role](/azure/role-based-access-control/built-in-roles#container-registry-repository-reader) (for ABAC-enabled registries) or the [AcrPull role](/azure/role-based-access-control/built-in-roles#acrpull)(for non-ABAC-enabled registries) for the kubelet identity that's associated with the AKS cluster to pull images from a container registry. Please see https://aka.ms/acr/auth/abac for more information on the necessary ACR role to assign based on whether your ACR registry is ABAC-enabled.
16
16
17
17
In some cases, trying to pull images from a container registry to an AKS cluster fails. This article provides guidance for troubleshooting the most common errors that you encounter when you pull images from a container registry to an AKS cluster.
18
18
@@ -24,7 +24,6 @@ This article assumes that you have an existing AKS cluster and an existing conta
24
24
25
25
- If you need an Azure Container Registry (ACR), create one by using [the Azure CLI](/azure/container-registry/container-registry-get-started-azure-cli) or [the Azure portal](/azure/container-registry/container-registry-get-started-portal).
26
26
27
-
28
27
You also need Azure CLI version 2.0.59 or a later version to be installed and configured. Run [az version](/cli/azure/reference-index#az-version) to determine the version. If you have to install or upgrade, see [Install Azure CLI](/cli/azure/install-azure-cli).
29
28
30
29
## Symptoms and initial troubleshooting
@@ -72,11 +71,15 @@ Several solutions can help you resolve this error, subject to the following cons
72
71
73
72
- Solutions [5][cause1-solution5] and [6][cause1-solution6] are applicable for the Kubernetes method of [pulling a Kubernetes secret](https://kubernetes.io/docs/tasks/configure-pod-container/pull-image-private-registry/).
74
73
75
-
#### Solution 1: Make sure AcrPull role assignment is created for identity
74
+
#### Solution 1: Make sure the correct ACR role assignment is created for identity
75
+
76
+
The integration between AKS and Container Registry creates the correct role assignment at container registry level for the AKS cluster's kubelet identity.
76
77
77
-
The integration between AKS and Container Registry creates an AcrPull role assignment at container registry level for the AKS cluster's kubelet identity. Make sure that the role assignment is created.
78
+
> [!NOTE]
79
+
> Make sure that the correct role assignment is created (`Container Registry Repository Reader` for ABAC-enabled regisries, and `AcrPull` for non-ABAC-enabled registries).
80
+
> Please see https://aka.ms/acr/auth/abac for more information on the correct ACR role needed based on whether the registry is ABAC-enabled or not.
78
81
79
-
To check whether the AcrPull role assignment is created, use one of the following methods:
82
+
To check whether the correct ACR role assignment exists, use one of the following methods:
80
83
81
84
- Run the following command:
82
85
@@ -86,14 +89,18 @@ To check whether the AcrPull role assignment is created, use one of the followin
86
89
87
90
- Check in the Azure portal by selecting **Azure Container Registry** > **Access control (IAM)** > **Role assignments**. For more information, see [List Azure role assignments using the Azure portal](/azure/role-based-access-control/role-assignments-list-portal).
88
91
89
-
Besides the AcrPull role, some [built-in roles](/azure/role-based-access-control/built-in-roles) and [custom roles](/azure/role-based-access-control/custom-roles) can also contain the "[Microsoft.ContainerRegistry](/azure/role-based-access-control/resource-provider-operations#microsoftcontainerregistry)/registries/pull/read" action. Check those roles if you've got any of them.
92
+
Besides either the `Container Registry Repository Reader` role (for ABAC-enabled registries) and `AcrPull` role (for non-ABAC-enabled registries), some [built-in roles](/azure/role-based-access-control/built-in-roles) and [custom roles](/azure/role-based-access-control/custom-roles) can also contain the necessary Entra permissions for image pull. Check those roles if you've got any of them.
90
93
91
-
If the AcrPull role assignment isn't created, create it by [configuring Container Registry integration for the AKS cluster](/azure/aks/cluster-container-registry-integration?tabs=azure-cli#configure-acr-integration-for-existing-aks-clusters) with the following command:
94
+
If either the `Container Registry Repository Reader` role (for ABAC-enabled registries) or `AcrPull` role (for non-ABAC-enabled registries) don't exist, you can create the role assignment.
95
+
96
+
For non-ABAC-enabled registries, you can assign the `AcrPull` role with the following command:
92
97
93
98
```azurecli
94
99
az aks update -n <myAKSCluster> -g <myResourceGroup> --attach-acr <acr-resource-id>
95
100
```
96
101
102
+
For ABAC-enabled registries, the `az aks --attach-acr` command does not support adding the `Container Registry Repository Reader` role. You must manually assign this role to the AKS kubelet identity with either the Azure Portal or the `az role assignment` CLI commands.
103
+
97
104
#### Solution 2: Make sure service principal isn't expired
98
105
99
106
Make sure that the secret of the service principal that's associated with the AKS cluster isn't expired. To check the expiration date of your service principal, run the following commands:
@@ -109,7 +116,7 @@ For more information, see [Check the expiration date of your service principal](
109
116
110
117
If the secret is expired, [update the credentials for the AKS cluster](/azure/aks/update-credentials).
111
118
112
-
#### Solution 3: Make sure AcrPull role is assigned to correct service principal
119
+
#### Solution 3: Make sure the correct ACR role is assigned to correct service principal
113
120
114
121
In some cases, the container registry role assignment still refers to the old service principal. For example, when the service principal of the AKS cluster is replaced with a new one. To make sure that the container registry role assignment refers to the correct service principal, follow these steps:
115
122
@@ -396,9 +403,9 @@ If the troubleshooting guidance in this article doesn't help you resolve the iss
396
403
397
404
[!INCLUDE [Azure Help Support](../../../includes/azure-help-support.md)]
0 commit comments