cloudnativer / kube-install

一键安装k8s(kubernetes):二進位離線方式部署,支持定時安裝、添加與銷毀node、銷毀與修復master、一鍵卸載集羣等。Install k8s (kubernetes): one click offline installation of highly available multiple kubernetes cluster, supports schedule installation, addition of nodes, rebuild of kubernetes master, and uninstallation of clusters.
Apache License 2.0
422 stars 118 forks source link

docker registry上传镜像报HTTPS的错怎么解决? #41

Open stevencaocao opened 2 years ago

stevencaocao commented 2 years ago

ERRO[0000] server "192.168.1.191:5000" does not seem to support HTTPS error="failed to do request: Head \"https://192.168.1.191:5000/v2/alpine/blobs/sha256:43773d1dba76c4d537b494a8454558a41729b92aa2ad0feb23521c3e58cd0440\": http: server gave HTTP response to HTTPS client" INFO[0000] Hint: you may want to try --insecure-registry to allow plain HTTP (if you are in a trusted network) FATA[0000] failed to do request: Head "https://192.168.1.191:5000/v2/alpine/blobs/sha256:43773d1dba76c4d537b494a8454558a41729b92aa2ad0feb23521c3e58cd0440": http: server gave HTTP response to HTTPS client

houseonline commented 2 years ago

這是可能你本地Docker配寘的問題,可以通過下麵的參攷方法進行配寘:

方法一: [root@linux-08]# vi /usr/lib/systemd/system/docker.service ExecStart=/usr/bin/dockerd --insecure-registry 192.168.1.191:5000

[root@linux-08]# systemctl daemon-reload && systemctl restart docker

方法二: [root@linux-08]# vi /etc/docker/daemon.json { "registry-mirrors": ["https://registry.docker-cn.com"], "insecure-registries": ["192.168.1.191:5000"] }

[root@linux-08]# systemctl daemon-reload && systemctl restart docker

方法三: [root@linux-08]# cat /etc/docker/daemon.json { "registry-mirrors": [ "https://registry.docker-cn.com" ] } { "insecure-registry":["192.168.1.191:5000"] }

[root@linux-08]# systemctl daemon-reload && systemctl restart docker

更多配寘請查看Docker官方檔案。

stevencaocao commented 2 years ago

你好!

我看了上面三种方法,都是常规安装docker和docker registry的解决办法, 使用kube-install一件安装k8s环境后,安装目录不清楚是哪一个,另外docker服务也并不是docker.service,找不到这个服务。具体看如下在node机器上的操作日志

[root@k8s ~]# find / -name docker.service /tmp/.kubeinstalltemp/data/k8s.cluster1/sys/0x0000000000base/docker/templates/docker.service [root@k8s ~]# find / -name docker find: ‘/proc/6132’: 没有那个文件或目录 /run/containerd/io.containerd.runtime.v2.task/k8s.io/8c5d65185bf730c9265c7439c7c81079e8c94e1f140d6a4d032f34bf00a1c898/rootfs/etc/docker /tmp/.kubeinstalltemp/data/k8s.cluster1/sys/0x0000000000base/docker /opt/kube-install/k8s/runtime/containerd/io.containerd.snapshotter.v1.overlayfs/snapshots/20/fs/etc/docker /opt/kube-install/k8s/runtime/containerd/io.containerd.snapshotter.v1.overlayfs/snapshots/169/fs/etc/docker [root@k8s ~]# systemctl daemon-reload && systemctl restart docker Failed to restart docker.service: Unit not found.

stevencaocao commented 2 years ago

你好! 问题已解决,由于我安装的k8s是1.24,容器改用containerd我还以为是docker,因此找不到以上docker配置及服务。 推送和拉取镜像使用ctr -n=k8s.io images push --plain-http=true 192.168.1.191:5000/镜像名称:镜像tag就可以了。 另外web页面里面给的例子少了--plain-http=true,因此按照例子做不成功。

houseonline commented 2 years ago

由于我安装的k8s是1.24,容器改用containerd我还以为是docker,因此找不到以上docker配置及服务。

如果你想使用docker的話,可以部署v1.23及以下版本。 由於k8s v1.24版本已經默認不支持docker了,所以我們相容了官方推薦的containerd。

houseonline commented 2 years ago

你好! 1.24,容器改用containerd。另外web页面里面给的例子少了--plain-http=true,因此按照例子做不成功。

Thank you very much for your feedback!

我們已經修復了這個問題,新發佈的版本中將不會有這個誤會的提示。