使用默认版本的busybox会出现nslookup提示无法解析的问题。使用1.28.3版本即可解决。
症状:
kubectl run busybox --rm -it --image=busybox /bin/sh
/ # nslookup httpd-svc
Server: 10.96.0.10
Address: 10.96.0.10:53
** server can't find httpd-svc.default.svc.cluster.local: NXDOMAIN
*** Can't find httpd-svc.svc.cluster.local: No answer
*** Can't find httpd-svc.cluster.local: No answer
*** Can't find httpd-svc.default.svc.cluster.local: No answer
*** Can't find httpd-svc.svc.cluster.local: No answer
*** Can't find httpd-svc.cluster.local: No answer
解决:
kubectl run busybox --rm -it --image=busybox:1.28.3 /bin/sh
If you don't see a command prompt, try pressing enter.
/ # nslookup httpd-svc
Server: 10.96.0.10
Address 1: 10.96.0.10 kube-dns.kube-system.svc.cluster.local
Name: httpd-svc
Address 1: 10.108.142.200 httpd-svc.default.svc.cluster.local