在新的vmware PKS kubernetes集群中,为私有docker-registry创建了秘密,并且可以按预期工作。但是,kubectl并未从公共注册表“ https://registry-1.docker.io/v2/”中提取图像。
我已连接到公司网络,并且http_proxy,https_proxy已设置为可以访问互联网。创建kubectl部署时,docker login,pull工作正常,但不会拉出图像。 “ dduportal / bats:0.4.0”的公共映像失败。 kubectl describe输出将复制到github中的path。
我试图分别为私有的公共docker注册表添加秘密。有人指出,如果要从多个私有注册表中提取图像,则要分开秘密。就我而言,它是公开的,但仍然分开。
kubectl create secret docker-registry regcred-public --docker-server=registry-1.docker.io --docker-username=<public-user> --docker-password=<token> --docker-email=<myemail>
kubectl create secret docker-registry regcred-private --docker-server=private-registry --docker-username=<private-user> --docker-password=password --docker-email=<myemail>
集群端是否需要任何规则/配置?
无法提取映像“ dduportal / bats:0.4.0”:rpc错误:代码=未知desc =来自守护程序的错误响应:获取https://registry-1.docker.io/v2/:net / http:请求在等待连接时被取消(Client.Timeout超过了等待标题)
问题可能在于代理HTTP的设置不正确。
首先,为Docker服务创建一个systemd插入目录:
mkdir /etc/systemd/system/docker.service.d
现在创建一个名为/etc/systemd/system/docker.service.d/http-proxy.conf
的文件,该文件添加HTTP_PROXY
环境变量:
[Service]
Environment="HTTP_PROXY=http://proxy.example.com:80/"
[如果您需要在不使用代理的情况下联系内部Docker注册表,则可以通过NO_PROXY
环境变量指定它们:
Environment="HTTP_PROXY=http://proxy.example.com:80/"
Environment="NO_PROXY=localhost,127.0.0.0/8,docker-registry.somecorporation.com"
刷新更改:
$ sudo systemctl daemon-reload
验证配置是否已加载:
$ sudo systemctl show --property Environment docker
Environment=HTTP_PROXY=http://proxy.example.com:80/
重新启动Docker:
$ sudo systemctl restart docker
链接到官方Docker文档以获取代理HTTP:docker-http。