Kubernetes CKA sample exam question 119 with answer

Question
List the DNS IP address(s) used by all pods in ALL namespaces. Save the output to /tmp/dns-ip.txt

Answer
Make a note of the IP address and write to the file /tmp/dns-ip.txt:

kubectl describe svc kube-dns -n kube-system | grep "IP"
Cluster component core-dns is the DNS server used by all pods in ALL namespaces. There is a corresponding service called kube-dns mapped with core-dns pods in the kube-system namespace. IP address of this service is set as DNS IP address in all pods.
You can verify that by checking the value of /etc/resolv.conf of any pod. It should match the IP address of kube-dns service.