TracyBin
TracyBin

Reputation: 5

kubedns can't nslookup any service

version 1.6.1.I setup kubernetes with kubeadm.DNS cant resolve kubernetes service within heapster. But using ip of kubernetes is OK. Below is the container log of kubedns

[root@node-47 ~]# docker logs 624905719fa2
I0512 04:29:57.374905       1 dns.go:49] version: v1.5.2-beta.0+$Format:%h$
I0512 04:29:57.380148       1 server.go:70] Using configuration read from directory: /kube-dns-config%!(EXTRA time.Duration=10s)
I0512 04:29:57.380219       1 server.go:112] FLAG: --alsologtostderr="false"
I0512 04:29:57.380231       1 server.go:112] FLAG: --config-dir="/kube-dns-config"
I0512 04:29:57.380238       1 server.go:112] FLAG: --config-map=""
I0512 04:29:57.380242       1 server.go:112] FLAG: --config-map-namespace="kube-system"
I0512 04:29:57.380245       1 server.go:112] FLAG: --config-period="10s"
I0512 04:29:57.380268       1 server.go:112] FLAG: --dns-bind-address="0.0.0.0"
I0512 04:29:57.380272       1 server.go:112] FLAG: --dns-port="10053"
I0512 04:29:57.380278       1 server.go:112] FLAG: --domain="cluster.local."
I0512 04:29:57.380283       1 server.go:112] FLAG: --federations=""
I0512 04:29:57.380288       1 server.go:112] FLAG: --healthz-port="8081"
I0512 04:29:57.380292       1 server.go:112] FLAG: --initial-sync-timeout="1m0s"
I0512 04:29:57.380295       1 server.go:112] FLAG: --kube-master-url=""
I0512 04:29:57.380300       1 server.go:112] FLAG: --kubecfg-file=""
I0512 04:29:57.380303       1 server.go:112] FLAG: --log-backtrace-at=":0"
I0512 04:29:57.380309       1 server.go:112] FLAG: --log-dir=""
I0512 04:29:57.380315       1 server.go:112] FLAG: --log-flush-frequency="5s"
I0512 04:29:57.380318       1 server.go:112] FLAG: --logtostderr="true"
I0512 04:29:57.380323       1 server.go:112] FLAG: --nameservers=""
I0512 04:29:57.380326       1 server.go:112] FLAG: --stderrthreshold="2"
I0512 04:29:57.380330       1 server.go:112] FLAG: --v="2"
I0512 04:29:57.380334       1 server.go:112] FLAG: --version="false"
I0512 04:29:57.380340       1 server.go:112] FLAG: --vmodule=""
I0512 04:29:57.380386       1 server.go:175] Starting SkyDNS server (0.0.0.0:10053)
I0512 04:29:57.380816       1 server.go:197] Skydns metrics enabled (/metrics:10055)
I0512 04:29:57.380828       1 dns.go:147] Starting endpointsController
I0512 04:29:57.380832       1 dns.go:150] Starting serviceController
I0512 04:29:57.381406       1 logs.go:41] skydns: ready for queries on cluster.local. for tcp://0.0.0.0:10053 [rcache 0]
I0512 04:29:57.381417       1 logs.go:41] skydns: ready for queries on cluster.local. for udp://0.0.0.0:10053 [rcache 0]
I0512 04:29:57.439494       1 dns.go:264] New service: monitoring-influxdb
I0512 04:29:57.439579       1 dns.go:462] Added SRV record &{Host:monitoring-influxdb.kube-system.svc.cluster.local. Port:8086 Priority:10 Weight:10 Text: Mail:false Ttl:30 TargetStrip:0 Group: Key:}
I0512 04:29:57.439601       1 dns.go:462] Added SRV record &{Host:monitoring-influxdb.kube-system.svc.cluster.local. Port:8083 Priority:10 Weight:10 Text: Mail:false Ttl:30 TargetStrip:0 Group: Key:}
I0512 04:29:57.439623       1 dns.go:264] New service: dai-1-daiym-context-46
I0512 04:29:57.439642       1 dns.go:264] New service: kubernetes
I0512 04:29:57.439722       1 dns.go:462] Added SRV record &{Host:kubernetes.default.svc.cluster.local. Port:443 Priority:10 Weight:10 Text: Mail:false Ttl:30 TargetStrip:0 Group: Key:}
I0512 04:29:57.439746       1 dns.go:264] New service: nginxservice
I0512 04:29:57.439766       1 dns.go:264] New service: heapster
I0512 04:29:57.439784       1 dns.go:264] New service: kube-dns
I0512 04:29:57.439803       1 dns.go:462] Added SRV record &{Host:kube-dns.kube-system.svc.cluster.local. Port:53 Priority:10 Weight:10 Text: Mail:false Ttl:30 TargetStrip:0 Group: Key:}
I0512 04:29:57.439818       1 dns.go:462] Added SRV record &{Host:kube-dns.kube-system.svc.cluster.local. Port:53 Priority:10 Weight:10 Text: Mail:false Ttl:30 TargetStrip:0 Group: Key:}
I0512 04:29:57.439834       1 dns.go:264] New service: kubernetes-dashboard
I0512 04:29:57.439851       1 dns.go:264] New service: monitoring-grafana
I0512 04:29:57.882534       1 dns.go:171] Initialized services and endpoints from apiserver
I0512 04:29:57.882995       1 server.go:128] Setting up Healthz Handler (/readiness)
I0512 04:29:57.883004       1 server.go:133] Setting up cache handler (/cache)
I0512 04:29:57.883009       1 server.go:119] Status HTTP port 8081

But I can't resolve any service within kubedns.

[root@node-47 ~]# docker exec -it 624905719fa2 sh
/ # nslookup nginxservice localhost
Server:    127.0.0.1
Address 1: 127.0.0.1 localhost

nslookup: can't resolve 'nginxservice': Try again
/ # nslookup heapster localhost
Server:    127.0.0.1
Address 1: 127.0.0.1 localhost

nslookup: can't resolve 'heapster': Try again

Upvotes: 0

Views: 557

Answers (1)

luke
luke

Reputation: 36

Please use full DNS name of service try again if service do not have the same namespace with DNS? Check https://kubernetes.io/docs/concepts/services-networking/dns-pod-service/ to get full dns name.

Upvotes: 1

Related Questions