nslookup does not resolve Kubernetes.default

11/7/2019

I tried the following command on my minikube setup to verify if dns is working fine or not.

kubectl exec -ti busybox -- nslookup kubernetes.default

but this is the output I am getting ' Server: 10.96.0.10 Address 1: 10.96.0.10

nslookup: can't resolve 'kubernetes.default'
command terminated with exit code 1'

Apart from that, I checked the coredns pod logs it shows something like below: ` 2019-11-07T12:25:23.694Z [ERROR] plugin/errors: 0 5606995447546819070.2414697521008405831. HINFO: read udp 172.17.0.5:60961-

10.15.102.11:53: i/o timeout `

Can some explain me what is going wrong? busybox image tag is image: busybox:1.28

-- Nish
kube-dns
kubernetes
kubernetes-pod

1 Answer

11/7/2019

Thats because your busybox pod know nothing about kubernetes.default Fix your /etc/resolv.conf

It should be like

search default.svc.cluster.local svc.cluster.local
nameserver 10.96.0.10
options ndots:5

Additionally you cat open Debugging DNS Resolution documentation and check provided examle for the same.

Take a look inside the resolv.conf file. (See Inheriting DNS from the node and Known issues below for more information)

kubectl exec busybox cat /etc/resolv.conf

Verify that the search path and name server are set up like the following (note that search path may vary for different cloud providers):

search default.svc.cluster.local svc.cluster.local cluster.local google.internal c.gce_project_id.internal
nameserver 10.0.0.10
options ndots:5

Errors such as the following indicate a problem with the coredns/kube-dns add-on or associated Services:

kubectl exec -ti busybox -- nslookup kubernetes.default
Server:    10.0.0.10
Address 1: 10.0.0.10

nslookup: can't resolve 'kubernetes.default'
or

kubectl exec -ti busybox -- nslookup kubernetes.default
Server:    10.0.0.10
Address 1: 10.0.0.10 kube-dns.kube-system.svc.cluster.local

nslookup: can't resolve 'kubernetes.default'
-- VKR
Source: StackOverflow