Interview Prep/Azure/AKS and ACR Errors

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.

Azure All Azure questions Roadmap: AKS & Azure DevOps

More on AKS and ACR Errors