Nslookup for pod using ns

controlplane $ kubectl get pods -o wide
NAME READY STATUS RESTARTS AGE IP NODE NOMINATED NODE READINESS GATES
nginx-deploy-7c8d8c76bf-5jbrn 1/1 Running 0 6m22s 10.244.1.9 node01
nginx-resolver 1/1 Running 0 4m42s 10.244.1.10 node01
redis-storage 1/1 Running 0 15m 10.244.1.5 node01
super-user-pod 1/1 Running 0 14m 10.244.1.6 node01
use-pv 1/1 Running 0 9m8s 10.244.1.7 node01

controlplane $ kubectl run dummy --image=busybox:1.28 --rm -it --restart=Never – nslookup 10.244.1.10.default.pod > /root/CKA/nginx.pod
pod default/dummy terminated (Error)

Can someone look into this imperative command and let me know anything wrong with nslookup using ipaddress.ns.pod?

controlplane $ kubectl run dummy --image=busybox:1.28 --rm -it --restart=Never – nslookup 10.244.1.10 > /root/CKA/nginx.pod

controlplane $ cat /root/CKA/nginx.pod
Server: 10.96.0.10
Address 1: 10.96.0.10 kube-dns.kube-system.svc.cluster.local

Name: 10.244.1.10
Address 1: 10.244.1.10 10-244-1-10.nginx-resolver-service.default.svc.cluster.local
pod “dummy” deleted

Try this
$ kubectl run test-dns-busybox -i -tty --image=busybox:1.28 --rm --restart=never -- nslookup nginx-resolver-service

Replace the service name with pod ip separated with - instead of .

10-0-0-31.default.pod

got it. Thanks for the response. I will try it out.

root@controlplane:~# kubectl run dummy --image=busybox:1.28 --rm -it --restart=Never – nslookup 10-244-0-7.default.pod Server: 10.96.0.10
Address 1: 10.96.0.10 kube-dns.kube-system.svc.cluster.local

Name: 10-244-0-7.default.pod
Address 1: 10.244.0.7 10-244-0-7.redis-storage-service.default.svc.cluster.local
pod “dummy” deleted

suggested solution worked fine. Thank you!!

Great!
You are welcome!