Kubernetes - DNS/Core DNS Issue - Public Domains are Not Resolving

6/24/2021

I've a kubernetes setup as mentioned below, but my DNS resolution is broken.

Here my POD

ubuntu@mylabs-u20:~/apps$ kubectl get pods -o wide
NAME       READY   STATUS    RESTARTS   AGE   IP           NODE         NOMINATED NODE   READINESS GATES
dnsutils   1/1     Running   0          49m   10.1.201.8   mylabs-u20   <none>           <none>
ubuntu@mylabs-u20:~/apps$

Here is /etc/resolv.conf inside POD

/ # cat /etc/resolv.conf
search default.svc.cluster.local svc.cluster.local cluster.local cloudflare.com
nameserver 10.152.183.10
options ndots:5
/ #
/ #

DNS Lookup Fails when it was not an FQDN (Ends without DOT)

/ # nslookup example.com
Server:         10.152.183.10
Address:        10.152.183.10#53

Non-authoritative answer:
*** Can't find example.com.cloudflare.com: No answer
/ #

DNS Lookup Works FINE when I enter FQDN (Ends with DOT)

/ # nslookup example.com.
Server:         10.152.183.10
Address:        10.152.183.10#53

Non-authoritative answer:
Name:   example.com
Address: 93.184.216.34
Name:   example.com
Address: 2606:2800:220:1:248:1893:25c8:1946

/ #

If I remove "cloudflare.com" (I have another domain in real) from /etc/resolv.conf, resolution woks fine too.

Here is the CoreDNS logs

1. When it is Working (removed cloudflare.com from the /etc/resolved.conf)

[INFO] 10.1.201.8:46058 - 15787 "A IN example.com.default.svc.cluster.local. udp 55 false 512" NXDOMAIN qr,aa,rd 148 0.000130316s
[INFO] 10.1.201.8:34316 - 9685 "A IN example.com.svc.cluster.local. udp 47 false 512" NXDOMAIN qr,aa,rd 140 0.000059917s
[INFO] 10.1.201.8:43405 - 60483 "A IN example.com.cluster.local. udp 43 false 512" NXDOMAIN qr,aa,rd 136 0.000044215s
[INFO] 10.1.201.8:48369 - 57170 "A IN example.com. udp 29 false 512" NOERROR qr,rd,ra 56 0.010594123s
[INFO] 10.1.201.8:33164 - 33975 "AAAA IN example.com. udp 29 false 512" NOERROR qr,rd,ra 68 0.009416379s

2. When it is NOT Working

[INFO] 10.1.201.8:34554 - 25035 "A IN example.com.default.svc.cluster.local. udp 55 false 512" NXDOMAIN qr,aa,rd 148 0.000101023s
[INFO] 10.1.201.8:38559 - 31524 "A IN example.com.svc.cluster.local. udp 47 false 512" NXDOMAIN qr,aa,rd 140 0.0000872s
[INFO] 10.1.201.8:50400 - 12732 "A IN example.com.cluster.local. udp 43 false 512" NXDOMAIN qr,aa,rd 136 0.00004631s
[INFO] 10.1.201.8:50010 - 42214 "A IN example.com.cloudflare.com. udp 44 false 512" NOERROR qr,rd,ra 130 0.042365179s
[INFO] 10.1.201.8:50528 - 22014 "AAAA IN example.com.cloudflare.com. udp 44 false 512" NOERROR qr,rd,ra 130 0.040545068s

Note: If I remove "cloudflare.com" from resolved.conf, it just works fine. Also, I can put "ibm.com" etc, works without any issues.

Please help me to fix this.

Thanks, Sethu M

-- SethuIT
dns
kubernetes

0 Answers