Here are steps to reproduce:
minikube start
kubectl run nginx --image=nginx
kubectl expose deployment nginx --port=80 --type=ClusterIP
kubectl run -i --tty --rm alpine --image=alpine --restart=Never -- sh
apk add --no-cache bind-toolsNow let's try to query kibe-dns for nginx service
with nslookup:
/ # nslookup nginx.default 10.96.0.10
Server:     10.96.0.10
Address:    10.96.0.10#53
Name:   nginx.default.svc.cluster.local
Address: 10.97.239.175and with dig:
dig nginx.default @10.96.0.10 any
; <<>> DiG 9.11.3 <<>> nginx.default @10.96.0.10 any
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 46414
;; flags: qr rd ra; QUERY: 1, ANSWER: 0, AUTHORITY: 0, ADDITIONAL: 1
;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 4096
;; QUESTION SECTION:
;nginx.default.         IN  ANY
;; Query time: 279 msec
;; SERVER: 10.96.0.10#53(10.96.0.10)
;; WHEN: Sun Jun 03 15:31:15 UTC 2018
;; MSG SIZE  rcvd: 42Nothing changes if I replace name nginx.default with just nginx.
minikube version: v0.27.0, k8s version: 1.10.0
Few things to point out:
dig nginx.default.svc.cluster.local NS you will see there are no hosting nameserver for it. You can only specify one when there are at least one exists.dig any in alpine doesn't really work so, so in this case, I am afraid that you have to explicitly use A or left it empty(A is default)Conclusion:
Run dig nginx.default.svc.cluster.local or dig nginx.default.svc.cluster.local A instead.