使用命令搭建好了k3s服务,也搭建了本地的registry,然后在k3s上建应用的时候,提示 

Head https://172.17.0.1:5000/v2/nginx5-wtf/manifests/2.0: http: server gave HTTP response to HTTPS client

说的是k3s去拉镜像的时候用的https,但是镜像服务不支持https,只支持http;

根据rancher的官方文档:https://docs.rancher.cn/docs/k3s/installation/private-registry/_index 

需要在/etc/rancher/k3s/registries.yaml 里配置成下面的样子。注意,用docker起rancher的时候,里面连vi都没有,用docker cp是最好的方法

rancher http 连接本地 或 私有的registry 仓库_rancher http registr

配置了之后,反复重启,不生效,最后查了一下,官方文档里是错的,

https://github.com/k3s-io/k3s/issues/1713 这里有个issue

需要改成 下面这样,其中 registry.local:5000,就是私有的镜像地址

docker cp registries.yaml eafa3e42cb6e:/etc/rancher/k3s/registries.yaml

mirrors:
  "registry.local:5000":
    endpoint:
      - "http://registry.local:5000"

rancher http 连接本地 或 私有的registry 仓库_rancher http registr_02