<p>I have setup <code>kubernetes</code> in <code>ubuntu 16.04</code>. I am using kube version <code>1.13.1</code> and using weave for networking. I have initialized the cluster using :</p>

<pre><code>sudo kubeadm init --token-ttl=0 --apiserver-advertise-address=192.168.88.142
</code></pre>

<p>and weave:</p>

<pre><code>kubectl apply -f "https://cloud.weave.works/k8s/net?k8s-version=$(kubectl version | base64 | tr -d '\n')"
</code></pre>

<p>All the pods seems to be running fine but <code>coredns</code> always remains in <code>CrashLoopBackOff</code> status. I have read mostly all the solution available for this. </p>

<pre><code>NAME                                READY   STATUS             RESTARTS   AGE
coredns-86c58d9df4-h5plc            0/1     CrashLoopBackOff   7          18m
coredns-86c58d9df4-l77rw            0/1     CrashLoopBackOff   7          18m
etcd-tx-g1-209                      1/1     Running            0          17m
kube-apiserver-tx-g1-209            1/1     Running            0          17m
kube-controller-manager-tx-g1-209   1/1     Running            0          17m
kube-proxy-2jdpp                    1/1     Running            0          18m
kube-scheduler-tx-g1-209            1/1     Running            0          17m
weave-net-npgnc                     2/2     Running            0          13m
</code></pre>

<p>I initially started by editing the cordens file and deleting the loop. It resolves the issue but then later I realized that I wasn't able to ping <code>www.google.com</code> from within the container but I was able to ping the ip address of google.com. Thus deleting the loop is not a perfect solution.</p>

<p>Next I tried looking at the <code>/etc/resolv.conf</code> and found below contents:</p>

<pre><code># 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 APSDC.local
</code></pre>

<p>Here is the <a href="https://github.com/coredns/coredns/tree/master/plugin/loop#troubleshooting-loops-in-kubernetes-clusters" rel="nofollow noreferrer">workaround</a> provided on kubernetes page which says that any type IP address like 127.0.0.1 should be avoided. I am not able to understand this line as this file is automatically generated. How can make changes to the file so that coredns can work fine. Belo is the logs of coredns:</p>

<pre><code>$ kubectl logs coredns-86c58d9df4-h5plc -n kube-system

.:53
2019-01-31T17:26:43.665Z [INFO] CoreDNS-1.2.6
2019-01-31T17:26:43.666Z [INFO] linux/amd64, go1.11.2, 756749c
CoreDNS-1.2.6
linux/amd64, go1.11.2, 756749c
[INFO] plugin/reload: Running configuration MD5 = f65c4821c8a9b7b5eb30fa4fbc167769
[FATAL] plugin/loop: Forwarding loop detected in "." zone. Exiting. See https://coredns.io/plugins/loop#troubleshooting. Probe query: "HINFO 1423429973721138313.4523734933111484351.".
</code></pre>

<p>Can anyone please point me to right direction in order to resolve this issue. Please help. Thanks</p>

<p>I have resolved this issue. In my case I had below contents of <code>/etc/resolv.conf</code></p>

<pre><code>nameserver     127.0.1.1
</code></pre>

<p>I first used the below command to get the correct IP as the device was in client's network.</p>

<pre><code>nmcli device show &lt;interfacename&gt; | grep IP4.DNS
</code></pre>

<p>After this I updated the file <code>/etc/resolvconf/resolv.conf.d/head</code> with below contents</p>

<pre><code>nameserver    192.168.66.21
</code></pre>

<p>and then run the below command to regenerate the resolv.conf</p>

<pre><code>sudo resolvconf -u
</code></pre>

<p>After this I had below contents in <code>/etc/resolv.conf</code>:</p>

<pre><code>nameserver    192.168.66.21
nameserver    127.0.1.1
</code></pre>

<p>I then deleted the <code>coredns</code> pods and everything worked fine. Thanks.</p>
