CoreDNS CrashLoopBackOff Kubernetes issue
pain with crashing coredns
matto@pc:~$ kubectl get pods --namespace=kube-system
NAME READY STATUS RESTARTS AGE
coredns-66bff467f8-j9lcr 1/1 Running 60 8m17s
coredns-66bff467f8-lf6vj 1/1 CrashLoopBackoff 99 8m17s
root cause of the issue
is described at https://github.com/coredns/coredns/tree/master/plugin/loop#troubleshooting
checking your /etc/resolv.conf
This file is overwritten by your network config
what helped me, to keep it's content:
chattr +i /etc/resolv.conf
this makes it immutable
sudo systemctl stop kubelet
sudo systemctl stop docker
sudo iptables --flush
sudo iptables -tnat --flush
sudo iptables -P FORWARD ACCEPT
sudo systemctl start docker
sudo systemctl start kubelet
sudo kubectl delete pods -n kube-system -l k8s-app=kube-dns
then, make sure that coreDNS starts and there are no restarts
sudo kubectl get pods --namespace=kube-system
NAME READY STATUS RESTARTS AGE
coredns-66bff467f8-bx5zc 1/1 Running 0 62s
coredns-66bff467f8-xv5sd 1/1 Running 0 62s
There should be no restarts !