Internal DNS Service in Kubernetes Environments

Within Rancher, we use our own internal DNS service in a Kubernetes environment and not the SkyDNS cluster add on that Kubernetes uses.

Service discovery works by listening for events in Kubernetes. Each service will get its own record created in the format <serviceName>.svc.cluster.local.

All services in the Kubernetes environment are resolvable by <serviceName>. DNS resolutions are done on a per service basis in the format of <serviceName>.<namespaceName>.svc.cluster.local, per the format of DNS in Kubernetes.

On the Rancher DNS side, the record gets mapped to:

  • Kubernetes Service Cluster IP: Kubernetes will distribute the traffic coming to this cluster IP to all the pod IPs associated to the cluster.
  • Headless Service Mode (No Cluster IP defined on the service): service fqdn gets mapped to IPs of all the pod IPs behind the service.


In a Kubernetes environment, let’s create a service foo in the namespace bar. There are 2 pods linked to the foo service. The IPs of the container pods are,

In this example, the service can be resolved by

If this service was headless, then will resolve to multiple A records, which are the IPs of the pods (i.e.,

If there is a cluster IP from the 10.42.x.x space (e.g., it will get resolved to the service’s cluster IP.