1

在一台主机(192.168.33.10)上安装了 Harbor。

在其他主机上安装了 Kubernetes 集群。

成功将 docker 镜像从客户端推送到 Harbor 主机。在 Kubernetes 主控主机上,我还可以成功地从 Harbor 主机拉取该映像:

$ 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

但我创建了一个 Kubernetes 部署 yaml 文件:

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

然后运行kubectl create -f deployment.yaml

从 Kubernetes 仪表板显示:

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

在此处输入图像描述

我已经设置好insecure-registries/etc/docker/daemon.json

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

如何从 Kubernetes 获得它?


编辑

我在 Rancher 服务器集群上使用 Kubernetes。即使我设置了Harbor服务器的IP,用户名和密码,它也无法访问:

在此处输入图像描述

4

0 回答 0