CoreDNS fails to run in Kubernetes cluster CoreDNS fails to run in Kubernetes cluster kubernetes kubernetes

CoreDNS fails to run in Kubernetes cluster


I also have the same issue.

I've solved the problem by deleting the plugins 'loop' within the cm of coredns.but i don't know if this cloud case other porblems.

1、kubectl edit cm coredns -n kube-system

2、delete ‘loop’ ,save and exit

3、restart coredns pods by:kubectl delete pod coredns.... -n kube-system


Somewhat resolved by using this way:

  1. open and edit the configmap of coredns.

    kubectl edit cm coredns -n kube-system

  2. "replacing proxy . /etc/resolv.conf with the ip address of your upstream DNS, for example proxy . 8.8.8.8." According to the link in the output ofthe coredns log (at the end of the page)
  3. save and exit.
  4. kubectl get pods -n kube-system -oname |grep coredns |xargs kubectl delete -n kube-system

The reason of the problem is explained in the link.You can find this link in the output of this cmd

kubectl logs coredns-7d9cd4f75b-cpwxp -n kube-system

This link is in the output of the CoreDNS-1.2.4.

I upgrade the CoreDNS using this cmd

kubectl patch deployment -n=kube-system coredns -p '{"spec": {"template": {"spec":{"containers":[{"image":"k8s.gcr.io/coredns:1.2.4", "name":"coredns","resources":{"limits":{"memory":"1Gi"},"requests":{"cpu":"100m","memory":"70Mi"}}}]}}}}'


I think simply delete loop function from Kubernetes is not a clean approach. CoreDNS Github actually provides some guidelines for trouble shooting this issue.

They suggest in their guideline about 3 approaches

  • Add the following to kubelet: --resolv-conf . Your "real" resolv.conf is the one that contains the actual IPs of your upstream servers, and no local/loopback address. This flag tells kubelet to pass an alternate resolv.conf to Pods. For systems using systemd-resolved, /run/systemd/resolve/resolv.conf is typically the location of the "real" resolv.conf, although this can be different depending on your distribution.
  • Disable the local DNS cache on host nodes, and restore /etc/resolv.conf to the original.
  • A quick and dirty fix is to edit your Corefile, replacing proxy . /etc/resolv.conf with the ip address of your upstream DNS, for example proxy . 8.8.8.8. But this only fixes the issue for CoreDNS, kubelet will continue to forward the invalid resolv.conf to all default dnsPolicy Pods, leaving them unable to resolve DNS.