Pods show `ImagePullBackOff` with `failed to authorize: failed to fetch anonymous token: unexpected status from GET request to https://acrshop.azurecr.io/oauth2/token?...: 401 Unauthorized`.
BeginnerTroubleshootingAKS and ACR Errors
Answer
Likely causes → The kubelet identity has no AcrPull on the registry (ACR not attached, attached to a different cluster, or role assigned to the cluster identity instead of the kubelet identity).
Diagnose →
az aks check-acr -g rg -n aks --acr acrshop.azurecr.io
KUBELET=$(az aks show -g rg -n aks --query identityProfile.kubeletidentity.objectId -o tsv)
az role assignment list --assignee $KUBELET --all -o table
Fix →
az aks update -g rg -n aks --attach-acr acrshop
Prevent → Manage the AcrPull role assignment for the kubelet identity in IaC.
More on AKS and ACR Errors
`Failed to pull image "acrshop.azurecr.io/shop/web:v3": ... manifest unknown` or `not found`.Beginner`ImagePullBackOff` with `dial tcp: lookup acrshop.azurecr.io on 168.63.129.16:53: no such host` or connection timeouts to the registry.Advanced`exec /usr/local/bin/python: exec format error` in pod logs right after deploying a new image.BeginnerPods are `Pending`: `0/3 nodes are available: 3 Insufficient cpu. preemption: 0/3 nodes are available: 3 No preemption victims found for incoming pod.`BeginnerCluster autoscaler events show `pod didn't trigger scale-up: 1 max node group size reached` or `NotTriggerScaleUp`.IntermediateAKS upgrade fails: `(UpgradeFailed) Drain node aks-apps-12345-vmss000002 failed when evicting pod web-7d9... failed with Too Many Requests error. This is often caused by a restrictive Pod Disruption Budget (PDB) policy.`Intermediate