k8s拉取Harbor私有仓库镜像报错,提示 connection refused?

harbor 环境:192.168.30.200,没有启用 https。

k8s 版本 1.24.5,容器运行时的版本如下

[root@master1 /etc/containerd]# ctr version
Client:
  Version:  v1.6.9
  Revision: 1c90a442489720eec95342e1789ee8a5e1b9536f
  Go version: go1.18.7

Server:
  Version:  v1.6.9
  Revision: 1c90a442489720eec95342e1789ee8a5e1b9536f
  UUID: c9f706f9-c33e-4b7f-bd82-324dde798c06
[root@master1 /etc/containerd]# nerdctl version
Client:
 Version:    v0.12.1
 Git commit:    6f0c8b7bc63270404c9f5810a899e6bae7546608

Server:
 containerd:
  Version:    v1.6.9
  GitCommit:    1c90a442489720eec95342e1789ee8a5e1b9536f

/etc/containerd/config.toml 配置了跳过证书校验的配置

[plugins."io.containerd.grpc.v1.cri".registry]
      config_path = ""

      [plugins."io.containerd.grpc.v1.cri".registry.auths]

      [plugins."io.containerd.grpc.v1.cri".registry.configs]
        [plugins."io.containerd.grpc.v1.cri".registry.configs."192.168.30.200".tls]
          insecure_skip_verify = true
        [plugins."io.containerd.grpc.v1.cri".registry.configs."192.168.30.200".auth]
          username = "admin"
          password = "Harbor12345"

使用 nerdctl 可以正常登录。

[root@master1 ~]# nerdctl --insecure-registry   login -u admin 192.168.30.200
Enter Password: INFO[0003] Error logging in to endpoint, trying next endpoint  error="Get \"https://192.168.30.200/v2/\": dial tcp 192.168.30.200:443: connect: connection refused"
Login Succeeded

但是拉取镜像失败,提示 connect: connection refused

# 用 nerdctl 拉取失败
[root@master1 ~]# nerdctl --insecure-registry pull 192.168.30.200/lnmp/hello-world:latest
WARN[0000] skipping verifying HTTPS certs for "192.168.30.200" 
INFO[0000] trying next host                              error="failed to do request: Head \"https://192.168.30.200/v2/lnmp/hello-world/manifests/latest\": dial tcp 192.168.30.200:443: connect: connection refused" host=192.168.30.200
FATA[0000] failed to resolve reference "192.168.30.200/lnmp/hello-world:latest": failed to do request: Head "https://192.168.30.200/v2/lnmp/hello-world/manifests/latest": dial tcp 192.168.30.200:443: connect: connection refused

# 用 ctr 拉取也失败
[root@master1 ~]# ctr images pull --user admin:Harbor12345 -k 192.168.30.200/lnmp/hello-world:latest
INFO[0000] trying next host                              error="failed to do request: Head \"https://192.168.30.200/v2/lnmp/hello-world/manifests/latest\": dial tcp 192.168.30.200:443: connect: connection refused" host=192.168.30.200
ctr: failed to resolve reference "192.168.30.200/lnmp/hello-world:latest": failed to do request: Head "https://192.168.30.200/v2/lnmp/hello-world/manifests/latest": dial tcp 192.168.30.200:443: connect: connection refused 


# 用 crictl 拉取也失败
[root@master1 ~]# crictl  pull 192.168.30.200/lnmp/hello-world:latest
E1109 11:36:05.369855   76039 remote_image.go:238] "PullImage from image service failed" err="rpc error: code = Unknown desc = failed to pull and unpack image \"192.168.30.200/lnmp/hello-world:latest\": failed to resolve reference \"192.168.30.200/lnmp/hello-world:latest\": failed to do request: Head \"https://192.168.30.200/v2/lnmp/hello-world/manifests/latest\": dial tcp 192.168.30.200:443: connect: connection refused" image="192.168.30.200/lnmp/hello-world:latest"
FATA[0000] pulling image: rpc error: code = Unknown desc = failed to pull and unpack image "192.168.30.200/lnmp/hello-world:latest": failed to resolve reference "192.168.30.200/lnmp/hello-world:latest": failed to do request: Head "https://192.168.30.200/v2/lnmp/hello-world/manifests/latest": dial tcp 192.168.30.200:443: connect: connection refused 

不知道如何解决,有大佬能看一下吗?

阅读 3.3k
撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题