Hi Team, I am digging into dns resolution from pods. I am seeing weird behavior . . .

Radoslaw Czajkowski:
Hi Team, I am digging into dns resolution from pods. I am seeing weird behavior - I saw this in online Kodekloud labs and I replicated this in my lab. So when I try to resolve kubernetes name (service name) from inside a pod - it doesn’t work. It works only from this special container dnsutils described in deteail here https://kubernetes.io/docs/tasks/administer-cluster/dns-debugging-resolution/ I am wondering what could be the difference? It should resolve it also from busybox as it is the same pod in terms of networking.

Radoslaw Czajkowski:
What’s more when i resolve it from dnsutils then it also resolves from busybox… but with additional zones mentioned.

Radoslaw Czajkowski:

Radoslaw Czajkowski:
From dnsutils it always works, from busybox it works randomly…

Duy Chu:
Use image busybox:1.28

unnivkn:
Hi @Radoslaw Czajkowski please try this:

unnivkn:
kubectl run nginx-resolver --image=nginx
kubectl expose pod nginx-resolver --name=nginx-resolver-service --port=80

kubectl get pods nginx-resolver -o wide

Note: endpoint IP is the IP of the Pod associated witht the svc
kubectl describe svc nginx-resolver-service

kubectl run test-nslookup --image=busybox:1.28 --rm -it – nslookup nginx-resolver-service
kubectl run test-nslookup --image=busybox:1.28 --rm -it – nslookup nginx-resolver-service > /root/nginx.svc
cat /root/nginx.svc

–get the IP of the pod
–Replace dot’s in ip with dash’s and use the namespace.pod
kubectl run test-nslookup --image=busybox:1.28 --rm -it – nslookup 10-32-0-5.default.pod > /root/nginx.pod
cat /root/nginx.pod

Radoslaw Czajkowski:
Thanks @Duy Chu and @unnivkn for detail example. It now works properly with busybox:1.28. Any idea why this image version is necessary?