nslookup: can't resolve kubernetes.default nslookup: can't resolve kubernetes.default kubernetes kubernetes

nslookup: can't resolve kubernetes.default


You have encountered a bug in the latest versions of the busybox docker image. Use the tag busybox:1.28 instead of latest. This 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"

Here it is failing with the busybox:latest tag.

$ kubectl run busybox --image busybox:latest --restart=Never --rm -it busybox -- shIf you don't see a command prompt, try pressing enter./ # nslookup kubernetes.defaultServer:         10.96.0.10Address:        10.96.0.10:53** server can't find kubernetes.default: NXDOMAIN*** Can't find kubernetes.default: No answer/ # exitpod "busybox" deleted

Here's the same command succeeding with the busybox:1.28 tag.

$ kubectl run busybox --image busybox:1.28 --restart=Never --rm -it busybox -- shIf you don't see a command prompt, try pressing enter./ # nslookup kubernetes.defaultServer:    10.96.0.10Address 1: 10.96.0.10 kube-dns.kube-system.svc.cluster.localName:      kubernetes.defaultAddress 1: 10.96.0.1 kubernetes.default.svc.cluster.local/ # exitpod "busybox" deleted


try this.

apiVersion: v1kind: Podmetadata:  name: dnsutils  namespace: defaultspec:  containers:  - name: dnsutils    image: gcr.io/kubernetes-e2e-test-images/dnsutils:1.3    command:      - sleep      - "3600"    imagePullPolicy: IfNotPresent  restartPolicy: Alwayssave this in yaml format and run kubectl apply -f <filename>.yaml and then run below commandvagrant@kubemaster:~$ kubectl exec -i -t dnsutils -- nslookup 10-40-0-2.default.pod  | tee nginx-podServer:     10.96.0.10Address:    10.96.0.10#53Name:   10-40-0-2.default.pod.cluster.localAddress: 10.40.0.2It should resolve the output and save it in the file.