nslookup can not get service ip on latest busybox

1/1/2020

Reproduce steps:

  1. kubectl run busybox1 --generator=run-pod/v1 --image=busybox:1.28 -- sleep 3600
  2. kubectl run busybox2 --generator=run-pod/v1 --image=busybox:1.31.1 -- sleep 3600
  3. kubectl exec -ti busybox1 -- nslookup kubernetes.default

works fine

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

  1. kubectl exec -ti busybox2 -- nslookup kubernetes.default

not working

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

command terminated with exit code 1

does nslookup work differently on 1.31.1?

what's the correct way to use nslookup on 1.31.1?

-- user1149293
busybox
docker
kubernetes

1 Answer

1/1/2020

DNS inside busybox only works correctly in images <= 1.28.4.

Fixing the version image: "busybox:1.28.0" should do the trick.

There's a thread here https://github.com/kubernetes/kubernetes/issues/66924

-- dysfunc
Source: StackOverflow