online
online

Reputation: 5527

How to get docker image from Harbor registry in Kubernetes cluster?

Installed Harbor on one host(192.168.33.10).

Installed Kubernetes cluster on other hosts.

Pushed docker images to Harbor host from client successfully. On Kubernets master host, I can also pull that image from Harbor host successfully:

$ docker pull 192.168.33.10/hello-world/hello-world
Using default tag: latest
latest: Pulling from hello-world/hello-world
3d19aeb159d4: Pull complete 
Digest: sha256:d9f41d096c0e1881e7a24756db9b7315d91c8d4bf1537f6eb10c36edeedde59f
Status: Downloaded newer image for 192.168.33.10/hello-world/hello-world:latest

But I created a Kubernetes deployment yaml file as:

apiVersion: extensions/v1beta1                                                                                                                                                                          
kind: Deployment                                                                                                                                                                                        
metadata:                                                                                                                                                                                               
  name: hello-world                                                                                                                                                                                     
spec:                                                                                                                                                                                                   
  template:                                                                                                                                                                                             
    metadata:                                                                                                                                                                                           
      labels:                                                                                                                                                                                           
        app: hello-world                                                                                                                                                                                
    spec:                                                                                                                                                                                               
      containers:                                                                                                                                                                                       
      - image: 192.168.33.10/hello-world/hello-world                                                                                                                                                    
        name: hello-world                                                                                                                                                                               
        imagePullPolicy: Always

Then run kubectl create -f deployment.yaml

From Kubernetes dashboard it showed:

Failed to pull image "192.168.33.10/hello-world/hello-world": rpc error: code = 2 desc = Error response from daemon: {"message":"Get https://192.168.33.10/v2/: dial tcp 192.168.33.10:443: getsockopt: connection refused"}
Error syncing pod

enter image description here

I already set insecure-registries in /etc/docker/daemon.json:

{ "insecure-registries":["192.168.33.10"] }

How can get that from Kubernetes?


Edit

I am using Kubernetes on Rancher server cluster. Even I set Harbor server's IP, username and password, it can't access, too:

enter image description here

Upvotes: 1

Views: 5032

Answers (0)

Related Questions