Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

nslookup can not get service ip on latest busybox

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?

like image 763
user1149293 Avatar asked Jan 01 '20 16:01

user1149293


1 Answers

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

like image 164
dysfunc Avatar answered Sep 29 '22 02:09

dysfunc