我正在尝试使用https://kubernetes.io/docs/tasks/administer-cluster/dns-debugging-resolution/在Kubernetes中学习DNS
kubectl get pods busybox -o wide
NAME READY STATUS RESTARTS AGE IP NODE
busybox 1/1 Running 0 16m 10.200.1.5 worker-1
kubectl exec -ti busybox -- nslookup kubernetes.default
Server: 10.32.0.10
Address 1: 10.32.0.10 kube-dns.kube-system.svc.cluster.local
nslookup: can't resolve 'kubernetes.default'
command terminated with exit code 1
nameserver 169.254.169.254
search c.k8s-project-193906.internal google.internal**
lsb_release -a
没有可用的LSB模块。
发行人ID:Ubuntu
说明:Ubuntu 18.04.1 LTS
发行:18.04
代号:仿生
请帮助我找出导致配置错误的配置。我是否需要更改resolve.conf文件并且基于什么?
最佳答案
您在最新版本的busybox docker镜像中遇到了一个错误。使用标签busybox:1.28
而不是latest
。这个bug link is here:
"Nslookup does not work in latest busybox image"
"1.27/1.28 are working , 1.29/1.29.1 are not"
这是失败,带有
busybox:latest
标记的。$ kubectl run busybox --image busybox:latest --restart=Never --rm -it busybox -- sh
If you don't see a command prompt, try pressing enter.
/ # nslookup kubernetes.default
Server: 10.96.0.10
Address: 10.96.0.10:53
** server can't find kubernetes.default: NXDOMAIN
*** Can't find kubernetes.default: No answer
/ # exit
pod "busybox" deleted
这是继和
busybox:1.28
标签之后的相同命令。$ kubectl run busybox --image busybox:1.28 --restart=Never --rm -it busybox -- sh
If you don't see a command prompt, try pressing enter.
/ # nslookup kubernetes.default
Server: 10.96.0.10
Address 1: 10.96.0.10 kube-dns.kube-system.svc.cluster.local
Name: kubernetes.default
Address 1: 10.96.0.1 kubernetes.default.svc.cluster.local
/ # exit
pod "busybox" deleted
关于kubernetes - nslookup : can't resolve kubernetes.默认,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/52109039/