1

I followed the next guide https://computingforgeeks.com/deploy-kubernetes-cluster-on-ubuntu-with-kubeadm/ in BareMetal Ubuntu 20.04 with 2 nodes.

I chose Docker as my Container Runtime and started the cluster with sudo kubeadm init --pod-network-cidr 10.16.0.0/16

Everything seems to run fine at the beginning The problem that I'm having is when a pod needs to connect to kube dns to resolve a domain name, although kubedns is working fine, so it seems that the problem is with the connection between. I ran the debugging tool for the DNS https://kubernetes.io/docs/tasks/administer-cluster/dns-debugging-resolution/ and when I ran kubectl exec -i -t dnsutils -- nslookup kubernetes I got the following output:

enter image description here

This are the logs of my kube dns: enter image description here

And this is the resolv.conf inside my pod: enter image description here

This is my kubectl and kubeadm info:

Client Version: version.Info{Major:"1", Minor:"20", GitVersion:"v1.20.4", GitCommit:"e87da0bd6e03ec3fea7933c4b5263d151aafd07c", GitTreeState:"clean", BuildDate:"2021-02-18T16:12:00Z", GoVersion:"go1.15.8", Compiler:"gc", Platform:"linux/amd64"}

kubeadm version: &version.Info{Major:"1", Minor:"20", GitVersion:"v1.20.4", GitCommit:"e87da0bd6e03ec3fea7933c4b5263d151aafd07c", GitTreeState:"clean", BuildDate:"2021-02-18T16:09:38Z", GoVersion:"go1.15.8", Compiler:"gc", Platform:"linux/amd64"}

[edit with extra information]

Calico Pods Status: enter image description here

Querying DNS directly: enter image description here

  • 1
    Doesn't the `pods-network-cidr` overlap with the IP range of your VMs ? Is it possible for you to share your `service-cidr` ? Do you have any additional cluster configuration e.g. k8s network policy, calico network policy ? Do you meet these [requirements](https://kubernetes.io/docs/setup/production-environment/tools/kubeadm/install-kubeadm/#before-you-begin) ? – matt_j Mar 19 '21 at 16:02
  • @matt_j thanks for commenting and sorry for the delay, my service-cidr is the default (10.96.0.0/12), the ip range of the servers is 172.22.0.0/16, and I'm using calico with default configuration of https://docs.projectcalico.org/manifests/calico.yaml. Regarding the requirements I didn't enable the required ports because I don't have the firewall enabled and I haven't configured the cgroup because I'm using Docker, I don't know if I'm wrong with this. – Ernesto Solano Mar 22 '21 at 10:28
  • Are Calico Pods working correctly (you can check by running: `kubectl get pod -n kube-system | grep calico`) ? Try `kubectl exec -i -t dnsutils -- nslookup kubernetes 10.96.0.10` to query DNS server directly. Additionally, try `kubectl exec -i -t dnsutils -- nslookup kubernetes.default.svc.cluster.local`. – matt_j Mar 23 '21 at 10:47
  • @matt_j I'll edit the question with this new information – Ernesto Solano Mar 23 '21 at 14:35
  • @matt_j I also have another k8s cluster in the same range of 172.22.0.0/16 do you think that can interfere? – Ernesto Solano Mar 23 '21 at 14:55
  • Can you check a few more things: [Is DNS service up?](https://kubernetes.io/docs/tasks/administer-cluster/dns-debugging-resolution/#is-dns-service-up) [Are DNS endpoints exposed?](https://kubernetes.io/docs/tasks/administer-cluster/dns-debugging-resolution/#are-dns-endpoints-exposed). Additionally kubernetes svc with `kubectl get svc kubernetes` command. – matt_j Mar 29 '21 at 16:01

1 Answers1

2

I use Flannel and had a similar problem. Restarting the coredns deployment solved it for me:

kubectl rollout restart -n kube-system deployment/coredns
dac.le
  • 75
  • 1
  • 6