Pod is unable to lookup ( mock Exam2 question 7)

Hello Team,

I’m performing correct steps as suggested in Mock Exam 2 solution but still nslookup is not happenning for pod.

Error:
controlplane ~ :heavy_multiplication_x: kubectl exec test-nslookup – nslookup nginx-resolver.default.pod.cluster.local
nslookup: can’t resolve ‘nginx-resolver.default.pod.cluster.local’
Server: 10.96.0.10
Address 1: 10.96.0.10 kube-dns.kube-system.svc.cluster.local

I’ve tried with pod name “busybox”

This appears to be an intermittent error in this lab; I’ve seen your issue occur previously, but trying it today, everything works:

controlplane ~ ➜  k run test-dns --image busybox:1.28 -- sleep 1d
pod/test-dns created

controlplane ~ ➜  k exec test-dns -- nslookup kubernetes.default
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

controlplane ~ ➜  k run nginx-resolver --image nginx
pod/nginx-resolver created

controlplane ~ ➜  k expose pod/nginx-resolver --name nginx-resolver-service --port 80
service/nginx-resolver-service exposed

controlplane ~ ➜  k exec test-dns -- nslookup nginx-resolver-service
Server:    10.96.0.10
Address 1: 10.96.0.10 kube-dns.kube-system.svc.cluster.local

Name:      nginx-resolver-service
Address 1: 10.99.118.178 nginx-resolver-service.default.svc.cluster.local

controlplane ~ ➜  k get po nginx-resolver -o wide
NAME             READY   STATUS    RESTARTS   AGE   IP             NODE     NOMINATED NODE   READINESS GATES
nginx-resolver   1/1     Running   0          91s   10.244.192.2   node01   <none>           <none>

controlplane ~ ➜  k exec test-dns -- nslookup 10-244-192-2.default.pod.cluster.local
Server:    10.96.0.10
Address 1: 10.96.0.10 kube-dns.kube-system.svc.cluster.local

Name:      10-244-192-2.default.pod.cluster.local
Address 1: 10.244.192.2 10-244-192-2.nginx-resolver-service.default.svc.cluster.local