使用最新版本的busybox会出现nslookup提示无法解析的问题:
Server: 10.96.0.10
Address: 10.96.0.10:53
** server can't find kubernetes: NXDOMAIN
*** Can't find kubernetes: No answer
该问题是最新busybox image问题导致的,使用老一点的busybox Image版本1.28.3、1.28.4即可成功解析。
[root@node01]# kubectl run -it --image=busybox:1.28.3 --restart=Never dns-test /bin/sh
/ # nslookup web-0.nginx
Server: 10.96.0.10
Address 1: 10.96.0.10 kube-dns.kube-system.svc.cluster.local
Name: web-0.nginx
Address 1: 10.244.0.78 web-0.nginx.default.svc.cluster.local
/ # nslookup web-1.nginx
Server: 10.96.0.10
Address 1: 10.96.0.10 kube-dns.kube-system.svc.cluster.local
Name: web-1.nginx
Address 1: 10.244.0.79 web-1.nginx.default.svc.cluster.local
[root@k8s-node1 opt]# k run busybox –rm -ti –image=busybox:1.28.3 –restart=Never /bin/sh
If you don't see a command prompt, try pressing enter.
/ # nslookup http://www.baidu.com
Server: 10.96.0.10
Address 1: 10.96.0.10
nslookup: can't resolve 'www.baidu.com'