Reproduce steps:
kubectl run busybox1 --generator=run-pod/v1 --image=busybox:1.28 -- sleep 3600
kubectl run busybox2 --generator=run-pod/v1 --image=busybox:1.31.1 -- sleep 3600
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
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?
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