[英]Configure kubernetes to pull from a registry service
So, I am trying to make my kube cluster pull from a registry running inside itself. 因此,我正在尝试使kube群集从自身内部运行的注册表中提取。 I have kube dns setup, I have a registry deployment and service running.
我有kube dns安装程序,有注册表部署和服务正在运行。 I can resolve the service internal name via host command on the node.
我可以通过节点上的主机命令来解析服务内部名称。 I have added
--dns
flag to docker daemon with the address of kube dns service. 我已经将
--dns
标志添加到具有kube dns服务地址的docker守护进程中。 I have kubelet running with --cluster-dns
flag set to the same address as well. 我有运行
--cluster-dns
标志也设置为相同地址的--cluster-dns
。 Yet somehow this is what I get when I try to create a pod using this registry. 但是以某种方式,这就是我尝试使用此注册表创建Pod时得到的结果。
Failed to pull image "kube-registry.kube-system.svc.cluster.local/myuser/myimage": rpc error: code = Unknown desc = Error response from daemon: Get https://kube-registry.kube-system.svc.cluster.local/v1/_ping: dial tcp: lookup kube-registry.kube-system.svc.cluster.local: no such host
Somehow even with kube dns address explicitly given to both dockerd and kubelet, pulling images from the registry service fails because of name resolution. 无论如何,即使将kube dns地址显式地分配给dockerd和kubelet,由于名称解析,从注册表服务中提取图像仍失败。 What am I missing?
我想念什么?
Another solution would be to add kube-dns IP to resolv.conf
: 另一个解决方案是将kube-dns IP添加到
resolv.conf
:
echo "nameserver $(kubectl -n kube-system get svc kube-dns -o jsonpath='{.spec.clusterIP}')" >> /etc/resolv.conf
CoreDNS service is exposed with static IP , so there's no need to keep it updated. CoreDNS服务使用静态IP公开,因此无需对其进行更新。
I can confirm it works on Ubunutu 18.04, despite the fact that resolv.conf
is generated by systemd-resolved
. 我可以确认它可以在Ubunutu 18.04上运行,尽管
resolv.conf
是由systemd-resolved
生成的。 No additional DNS configuration was required. 不需要其他DNS配置。 The services available by FQDNs only:
仅FQDN提供的服务:
root@dev:~# nslookup harbor.default.svc.cluster.local
;; Got SERVFAIL reply from 127.0.0.53, trying next server
Server: 10.96.0.10
Address: 10.96.0.10#53
Name: harbor.default.svc.cluster.local
Address: 10.109.118.191
;; Got SERVFAIL reply from 127.0.0.53, trying next server
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.