DNS for Services and Pods
Every new Service object in Kubernetes gets assigned a DNS name. The Kubernetes DNS component schedules a DNS name for the pods and services created on the cluster, and then the Kubelets are configured so containers can resolve these DNS names.
Considering previous examples, assume there is a Service named my-konvoy-service
in the Kubernetes namespace default
. A Pod running in namespace default
can look up this service by performing a DNS query for my-konvoy-service
. A Pod running in namespace kommander
can look up this service by performing a DNS query for my-konvoy-service.default
.
In general, a pod has the following DNS resolution:
pod-ip-address.namespace-name.pod-name.cluster-domain.example.
Similarly, a service has the following DNS resolution:
service-name.namespace-name.svc.cluster-domain.example.
You can find additional information about all the possible record types and layout here.