Unable to pull the image to run a pod in kubernetes

8/2/2018

Image of Pod Detail enter image description here Failed to pull image The image has been pushed in the azure registry through docker for windows. image name provided: as provided during tag through docker

-- Divya
kubernetes

2 Answers

8/2/2018

You currently provided very little detail.

Is your kubernetes cluster correctly configured to pull images from azure registry ? As far as I can see it isn't. Is this a managed AKS k8s cluster? If not, by default won't be able to access your private azure registry and will need to be configured with the credentials needed to access your private azure registry.

http://docs.heptio.com/content/private-registries/pr-docker-hub.html

Another possibility is you're pushing a Windows-based container onto linux based worker nodes which can only run linux based containers.

-- Philip Rodriguez
Source: StackOverflow

8/3/2018

I only have experience with GKE but if you want to pull docker images from a repository that is not in the same project as the GKE cluster, you have to provide credentials for the image to be pulled.

I do this with a secret in Kubernetes that contains a .dockerconfig.json:

apiVersion: v1
data:
  .dockerconfigjson: <REDACTED>

In order to create a secret of this type i've used a template as such:

kubectl create secret docker-registry <SECRET_NAME> \
  --docker-server=https://gcr.io \
  --docker-username=_json_key \
  --docker-email=<SVC_ACCOUNT_EMAIL> \
  --docker-password=<CONTENTS_OF_SVC_ACCOUNT_CREDS_FILE>

Once thats created you will need to mount to secret to the relevant pods / deployment. In the pod spec you will need:

imagePullSecrets:
      - name: <SECRET_NAME>

(its a list because you can mount many secrets to pull from other places)

I imagine that azure has a similar setup whereby any images in the same project as the cluster will be able to be pulled. But any images hosted in another azure project or external image repo will need credentials. I use the setup described to also pull google container registry images to a local minikube.

So I think we need to work out where your docker image is hosted and if credentials are needed to pull that image.

-- hawksight
Source: StackOverflow