coredns pod status is CrashLoopBackOff

$ kubectl get pod -n kube-system
NAME                              READY   STATUS             RESTARTS   AGE
coredns-fb8b8dccf-cl9rp           0/1     CrashLoopBackOff   6          10m
coredns-fb8b8dccf-v4lsv           0/1     CrashLoopBackOff   6          10m
etcd-pytimer                      1/1     Running            0          9m24s
kube-apiserver-pytimer            1/1     Running            0          9m21s
kube-controller-manager-pytimer   1/1     Running            0          9m24s
kube-flannel-ds-amd64-84vxg       1/1     Running            0          8m14s
kube-proxy-cgqpn                  1/1     Running            0          10m
kube-scheduler-pytimer            1/1     Running            0          9m15s

查看coredns pod的日志,发现如下错误:

$ kubectl logs -n kube-system coredns-fb8b8dccf-cl9rp
.:53
2019-03-26T13:58:34.693Z [INFO] CoreDNS-1.3.1
2019-03-26T13:58:34.694Z [INFO] linux/amd64, go1.11.4, 6b56a9c
CoreDNS-1.3.1
linux/amd64, go1.11.4, 6b56a9c
2019-03-26T13:58:34.694Z [INFO] plugin/reload: Running configuration MD5 = 599b9eb76b8c147408aed6a0bbe0f669
2019-03-26T13:58:34.694Z [FATAL] plugin/loop: Loop (127.0.0.1:51824 -> :53) detected for zone ".", see https://coredns.io/plugins/loop#troubleshooting. Query: "HINFO 5012779829032833898.3830104233741532924."

查看宿主机上的dns配置

$ cat /etc/resolv.conf
# Dynamic resolv.conf(5) file for glibc resolver(3) generated by resolvconf(8)
#     DO NOT EDIT THIS FILE BY HAND -- YOUR CHANGES WILL BE OVERWRITTEN
nameserver 127.0.1.1
search lan

更改nameserver,不使用127.0.1.1

修改/etc/NetworkManager/NetworkManager.conf,注释掉dns=dnsmasq

[main]
plugins=ifupdown,keyfile,ofono
#dns=dnsmasq

重启服务:service network-manager restart

可以看到coredns的pod正常启动

$ kubectl get pod -n kube-system
NAME                              READY   STATUS    RESTARTS   AGE
coredns-fb8b8dccf-gctnk           1/1     Running   0          33s
coredns-fb8b8dccf-zx246           1/1     Running   0          33s
etcd-pytimer                      1/1     Running   0          10m
kube-apiserver-pytimer            1/1     Running   0          10m
kube-controller-manager-pytimer   1/1     Running   0          10m
kube-flannel-ds-amd64-84vxg       1/1     Running   0          8m57s
kube-proxy-cgqpn                  1/1     Running   0          10m
kube-scheduler-pytimer            1/1     Running   0          9m58s