Kubernetes 101 : Service discovery - kube-dns -

To communicate with the database pods in our diagram below, our "mginxpodneeds to go through the "database-service" service that will forward the request to one of its database pods.

To be able to get the IP address of the "database-service", our pod needs to ask the "kube-dns" service.

Our pods and services:

To be able to see the pods and services in the cluster, we use the below command:

Our DNS service:

We display our DNS service that lives in the "kube-system" namespace using the below command:

We can get inside our pod "nginxpod-hjf3g12g4-hfdvc", and check its DNS server:

We notice that the nameserver points to the "kube-dns" service.


Leave as a comment: