nslookup does not resolve Kubernetes.default

天涯浪子 提交于 2020-01-25 08:02:28

问题


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


回答1:


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'


来源:https://stackoverflow.com/questions/58749299/nslookup-does-not-resolve-kubernetes-default

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!