I create a single master cluster with kubeadm, everything is fine but CoreDNS didn't work

4/25/2019

I create a single master cluster with kubeadm, according to doc, I did it like this:

kubeadm init --pod-network-cidr=172.20.0.0/16
kubectl apply -f rbac-kdd.yaml
kubectl apply -f calico.yml

Now, everything is fine, all pods and services are running, but when I test CoreDNS, the problem is arise. I create a pod to test dns:

kubectl exec busybox -- nslookup kubernetes

It cannot resolve the kubernetes.

I think it maybe because the master IP is 10.0.197.143, and CoreDNS service's cluster-ip is 10.96.0.10. If I'm right, how can I change cluster-ip range?

-- Juey
calico
kube-dns
kubernetes

1 Answer

4/30/2019

As per documentation:

For Calico to work correctly, you need to pass --pod-network-cidr=192.168.0.0/16 to kubeadm init or update the calico.yml

For troubleshooting purposes pleas run:

kubectl get svc,pods --all-namespaces
kubectl logs <your coredns-pod> -n kube-system
kubectl get pods --namespace=kube-system
kubectl get ep kube-dns --namespace=kube-system
   In addition using new deployed pod:
cat /etc/resolv.conf
nslookup kubernetes.default

Please share with logs and findings

More details about troubleshooting you can find also here:

-- Hanx
Source: StackOverflow