kmkale:
I have a question about CKA Mock Exam 2, question no 7:
I am able to get the service name resolution working, but the pod name resolution does not work.
Here are the steps I took to solve the question and verify:
- Command used to create the pod:
k run nginx-resolver --image=nginx --port=80
- Command used to expose pod:
k expose po nginx-resolver --name=nginx-resolver-service --port=80 --target-port=80
- Command used to check dns lookup for service works from inside the cluster:
k run bb --image=busybox:1.28 --restart=Never -it --rm -- nslookup nginx-resolver-service > /root/CKA/nginx.svc
Output: controlplane $ cat /root/CKA/nginx.svc
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.100.196.52 nginx-resolver-service.default.svc.cluster.local
pod "bb" deleted
- Command used to check Pod dns lookup works from inside the cluster:
k run bb --image=busybox:1.28 --restart=Never -it --rm -- nslookup nginx-resolver > /root/CKA/nginx.pod
Output:
/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
nslookup: can't resolve 'nginx-resolver'
pod "bb" deleted
What could be the problem with service dns resolution works but pod dns resolution fails?