Getting "unauthorized: authentication required" when pulling ACR images from Azure Kubernetes Service

8/21/2018

I followed the guide here (Grant AKS access to ACR), but am still getting "unauthorized: authentication required" when a Pod is attempting to pull an image from ACR.

The bash script executed without any errors. I have tried deleting my Deployment and creating it from scratch kubectl apply -f ..., no luck.

I would like to avoid using the 2nd approach of using a secret.

-- Jeff
azure-container-registry
azure-container-service
azure-kubernetes
docker
kubernetes

2 Answers

8/21/2018

The link you posted in the question is the correct steps for Authenticate with Azure Container Registry from Azure Kubernetes Service. I tried before and it works well.

So I suggest you can check if the service-principal-ID and service-principal-password are correct in the command kubectl create secret docker-registry acr-auth --docker-server <acr-login-server> --docker-username <service-principal-ID> --docker-password <service-principal-password> --docker-email <email-address>. And the secret you set in the yaml file should also be check if the same as the secret you created.

-- Charles Xu
Source: StackOverflow

11/14/2018

Jeff & Charles - I also experienced this issue, but found that the actual cause of the issue was that AKS was trying to pull an image tag from the container registry that didn't exist (e.g. latest). When I updated this to a tag that was available (e.g. 9) the deployment script on azure kubernetes service (AKS) worked successfully.

I've commented on the product feedback for the guide to request the error message context be improved to reflect this root cause.

Hope this helps! :)

-- Matt Woodward
Source: StackOverflow