Kubernetes DNS fails to resolve most of the times but sometimes it works. What can i do to solve this?

2/10/2020

Kubernetes not able to resolve DNS. Container/Pods not able to access Internet.

I have a Kubernetes 2 node cluster on separate AWS EC2 instances (t2.Medium) container networking has been done using: Flannel version: flannel:v0.10.0-amd64 (image) Kubernetes version: 1.15.3

DNS Logs DNS Logs

nodes

Kubernetes svc:

enter image description here

enter image description here

At times when I delete core-dns pods, the DNS issue gets resolved for some time but it is not consistant. Please suggest what can be done. I flannel mapping may have something to do with this. Please let me know if any other information is also needed.

-- Manik Malhotra
amazon-ec2
amazon-web-services
dns
flannel
kubernetes

1 Answer

2/10/2020

Errors such you get: nslookup: can't resolve 'kubernetes.default' indicate that you have problem with the coredns/kube-dns add-on or associated Services.

Please check if you did following steps to debug DNS: coredns.

It also seems that like DNS inside busybox does not work properly.

Try to use busybox images <= 1.28.4

Change pod configuration file:

  containers:
  - name: busybox-image
    image: busybox:1.28.3

Learn more about most known dns kubernetes issues: kubernetes-dns.

-- MaggieO
Source: StackOverflow