用户工具

站点工具


02-工程实践:kubernetes:issue:dnspolicy问题

dnsPolicy问题

hostNetwork容器内无法解析集群内部域名 https://blog.csdn.net/iiiiher/article/details/77099059

dnsPolicy为Default时,会继承node节点上的/etc/resolv.conf

node上使用了dnsmasq时,/etc/resolv.conf监听127.0.0.1,非hostNetwork的容器将无法使用127.0.0.1作为dns服务器(无法获得使用dns缓存的好处),考虑将127.0.0.1改为tunl0地址

如果改了,coredns部署方式就基本不用变化了,直接proxy . /etc/resolv.conf

ClusterFirstWithHostNet

当设置了 hostNetwork: true 时,ClusterFirst无效,会直接继承node的resolv.conf,因此需要设置dnsPolicy为ClusterFisrtWithHostNet

nameserver 169.169.0.2
search default.svc.cluster.local svc.cluster.local cluster.local
options ndots:5
02-工程实践/kubernetes/issue/dnspolicy问题.txt · 最后更改: 2020/04/07 06:34 由 annhe