coredns CrashLoopBackOff 报错

1.kubectl logs -f coredns-99b9bb8bd-47mvf -n kube-system

.:53
2018/09/22 07:39:37 [INFO] CoreDNS-1.2.2
2018/09/22 07:39:37 [INFO] linux/amd64, go1.11, eb51e8b
CoreDNS-1.2.2
linux/amd64, go1.11, eb51e8b
2018/09/22 07:39:37 [INFO] plugin/reload: Running configuration MD5 = f65c4821c8a9b7b5eb30fa4fbc167769
2018/09/22 07:39:38 [FATAL] plugin/loop: Seen "HINFO IN 8205794187887631643.5216586587165434789." more than twice, loop detected

参考这篇文章: https://github.com/coredns/coredns/issues/1986

从这篇文章得到提示,coredns pod会取宿主机的/etc/resolv.conf里面定义的nameserver作为自己的upstream server。而ubuntu的这个文件定义的nameserver是127.0.0.1,那么问题来了,coredns向127.0.0.1查询,而127.0.0.1代表本机,就这样形成死循环,也解释了为什么上面的日志提示"loop detected"

  • 修改/etc/resolv.conf
    这个文件是自动生成的,无法手工修改。上网找了一大堆办法

修改 /etc/network/interfaces
auto enp2s0
iface enp2s0 inet dhcp
dns-nameservers 114.114.114.114

systemctl restart networking

修改/etc/dhcp/dhclient.conf
prepend domain-name-servers 114.114.114.114;

systemctl restart networking
统统没用,/etc/resolv.conf里面只有nameserver 127.0.0.1

苍天不负有心人,终于被我找到这篇文章

https://askubuntu.com/questions/627899/nameserver-127-0-1-1-in-resolv-conf-wont-go-away/627900#627900
原来只要简单粗暴地,把原来的/etc/resolv.conf删掉,重新创建一个新文件,把nameserver写进去,就行了

 

参考:http://blog.51cto.com/355665/2178181

 
posted @ 2018-11-10 23:23  littlevigra  阅读(5015)  评论(0编辑  收藏  举报