Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

kubectl not able to pull the image from private repository

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
like image 848
sitakant Avatar asked Feb 16 '17 07:02

sitakant


People also ask

How do I pull an image from a private repository?

In order to pull images from your private repository, you'll need to login to Docker. If no registry URI is specified, Docker will assume you intend to use or log out from Docker Hub. Triton comes with several images built-in. You can view the available list with triton images .

How can I retrieve photos from private registry in Kubernetes?

To pull the image from the private registry, Kubernetes needs credentials. The imagePullSecrets field in the configuration file specifies that Kubernetes should get the credentials from a Secret named regcred .

How do I access private Docker images?

Navigate to Docker Hub create a Docker ID and select the personal subscription. Using docker login from the CLI, log in using your original Docker ID and pull your private images. The private images that existed in your previous namespace are now available in your new Docker ID namespace.


Video Answer


1 Answers

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.

like image 65
Janos Lenart Avatar answered Sep 18 '22 16:09

Janos Lenart