DNS for services

Not originally part of the core distribution, there is a cluster add-on that is now included for all clusters in version 1.3 (and later) that provides internal DNS services for Kubernetes. Minikube, for example, includes this add-on, and it is likely already running within your cluster.

A DNS entry is created and coordinates with every service defined, so that you can request the DNS entry for <service> or  <service>.<namespace>, and the internal DNS services will provide you with a correct internal IP address.

For example, if we exposed the flask deployment with the expose command, the service would be listed in DNS from our containers. We could open an interactive Terminal to an existing Pod and check on that DNS:

kubectl ...

Get Kubernetes for Developers now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.