I am trying to get images in minikube from the Azure container registry. This keeps failing because not it says unauthorized. unauthorized: authentication required
I used kubectl create secret to add the credentials for the registry but it keeps failing.
what I tried so far:
Getting bit desperate what I can try next? how can I troubleshoot this better?
The kubectl create secret
command should have produced a ~/.dockercfg file, which is used to authenticate with the registry for subsequent docker push
and docker pull
requests.
I suspect you may have created your secret in the wrong namespace, given that your docker login
and docker pull
commands worked.
Pods can only reference image pull secrets in their own namespace, so this process needs to be done one time per namespace.
https://kubernetes.io/docs/concepts/containers/images/#using-azure-container-registry-acr
You can create a secret and save it at your kubernetes context (in your case minikube context).
kubectl config get-contexts
and kubectl config use-context minikube
to change to minikube context.kubectl create secret docker-registry acr-secret --docker-server=<your acr server>.azurecr.io --docker-username=<your acr username> --docker-password=<your acr password>
. This command generates acr-secret.acr-secret
into deployment yml files by using the imagePullSecrets inside each template.spec tag: imagePullSecrets:
- name: acr-secret
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With