panchalhimself

DNS in kubernetes

21 June 2023

k8s internal virtual network uses dns to allow pods and services to communicate via domains instead of ips.

dns runs as a service in the cluster as a pod.

pod-ip-address.namespace-name.pod.cluster.local

pod-ip-address is ip separated by - instead of .

example:

Pod with 192.169.10-100 ip in default namespace will have dns as

192-168-10-100.default.pod.cluster.local


DNS of services

service-name.namespace-name.svc.cluster-domain.example

default cluster domain is cluster.local

a serice FQDN can be used to reach service from any namespace in the cluster.

To access a service in the same namespace only service name can be used.