Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

minikube and azure container registry

Tags:

minikube

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:

  • I added the URL with and without https
  • I added the admin user and made a new service principle
  • I tried to add the secret to the default service account in hope something was wrong with the yaml
  • used minikube ssh to see if could use docker login and docker pull (that worked).

Getting bit desperate what I can try next? how can I troubleshoot this better?

like image 492
Dave Smits Avatar asked Dec 21 '17 21:12

Dave Smits


2 Answers

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

like image 185
grizzthedj Avatar answered Oct 15 '22 05:10

grizzthedj


You can create a secret and save it at your kubernetes context (in your case minikube context).

  1. Firstly be sure that you are pointing to the right context by running kubectl config get-contexts and kubectl config use-context minikube to change to minikube context.
  2. Create a secret in minikube context by running 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.
  3. Import the acr-secret into deployment yml files by using the imagePullSecrets inside each template.spec tag:
    imagePullSecrets:
      - name: acr-secret
like image 1
joaogouveia Avatar answered Oct 15 '22 07:10

joaogouveia