kubernetes 鏈接私有庫

使用kubespray搭建的kubernetes集羣,鏈接私有庫報錯docker

[root@Control k8s]# docker push 192.168.5.2:5000/centos6-ssh
The push refers to a repository [192.168.5.2:5000/centos6-ssh]
unable to ping registry endpoint https://192.168.5.2:5000/v0/
v2 ping attempt failed with error: Get https://192.168.5.2:5000/v2/: http: server gave HTTP response to HTTPS client
 v1 ping attempt failed with error: Get https://192.168.5.2:5000/v1/_ping: http: server gave HTTP response to HTTPS client

通常docker 須要修改 /etc/docker/daemon.json 增長json

{ "insecure-registries":["a.b.cn:5000"] }
service docker restart

可是針對於kubespray搭建的,這樣重啓docker會報錯,由於在kubespray啓動時已經加入了centos

insecure-registries參數,只須要修改k8s-cluster.ymlssh

docker_options: "--insecure-registry={{ kube_service_addresses }} --insecure-registry=a.b.cn:5000 --graph={{ docker_daemon_graph }}  {{ docker_log_opts }}"rest

而後重啓集羣就好了code

相關文章
相關標籤/搜索