16

I am running kubeadm alpha version to set up my kubernates cluster. From kubernates , I am trying to pull docker images which is hosted in nexus repository. When ever I am trying to create a pods , It is giving "ImagePullBackOff" every time. Can anybody help me on this ?

Detail for this are present in https://github.com/kubernetes/kubernetes/issues/41536

Pod definition :

apiVersion: v1
kind: Pod
metadata:
  name: test-pod
  labels:
    name: test
spec:
  containers:
    - image: 123.456.789.0:9595/test
      name: test
      ports:
        - containerPort: 8443
  imagePullSecrets:
    - name: my-secret
sitakant
  • 1,766
  • 2
  • 18
  • 38

2 Answers2

15

You need to refer to the secret you have just created from the Pod definition.

When you create the secret with kubectl create secret docker-registry my-secret --docker-server=123.456.789.0 ... the server must exactly match what's in your Pod definition - including the port number (and if it's a secure one then it also must match up with the docker command line in systemd).

Also, the secret must be in the same namespace where you are creating your Pod, but that seems to be in order.

Janos Lenart
  • 25,074
  • 5
  • 73
  • 75
  • 3
    I have added imagePullSecrets into the pod definition . – sitakant Feb 16 '17 at 09:15
  • Port numbers match up? – Janos Lenart Feb 16 '17 at 10:05
  • Thanks for the reply. I don't have access to the PC for now. I'll update the pod configuration ASAP. – sitakant Feb 16 '17 at 10:26
  • Now, the pod definition has added. Could you please help me to figure out the error ? – sitakant Feb 16 '17 at 14:38
  • In the kubernetes issue linked you are quoting your command as `kubectl create secret docker-registry my-secret --docker-server=123.456.789.0 --docker-username=admin --docker-password=XXXX --docker-email=test@xyz.com` . Have you fixed it since to say `kubectl create secret docker-registry my-secret --docker-server=123.456.789.09:9595 --docker-username=admin --docker-password=XXXX --docker-email=test@xyz.com` (note the port number)? – Janos Lenart Feb 16 '17 at 14:44
  • Can you increase kubelet log level to 4 (`--v=4`) and post parts of the log (`journalctl -u kubelet`)? – Janos Lenart Feb 16 '17 at 14:50
  • Let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/135872/discussion-between-sitakant-and-janos-lenart). – sitakant Feb 16 '17 at 15:02
  • Thanks for the "same namespace" - that was the issue in my case. – setevoy Jan 28 '20 at 13:58
0

I received similar error while launching containers from the amazon ECR registry. The issue was that I didn;t mention the exact "Image URI" location in deployment file.

user3627034
  • 1,175
  • 8
  • 13