Every pod in a Kubernetes cluster can find every Service by name, with zero DNS configuration from you. Type db in your app's connection string and it just works. This post takes that magic apart, one concept at a time, on a live cluster — because DNS is the thing everyone blames during an outage, and the thing surprisingly few people can actually debug.
Everything below was run on a real cluster on my machine. The outputs are real. You should run it too — total time is about an hour, and the cluster is disposable.
Why kind?
Any local Kubernetes works for this — kind, k3d, minikube, microk8s — because every one of them ships CoreDNS as the cluster DNS (it's been the default since Kubernetes 1.13, replacing the older kube-dns). But they're not equally good for learning:
kind (Kubernetes in Docker) uses a vanilla kubeadm-style deployment, so its CoreDNS setup matches the official docs exactly. What you learn transfers 1:1 to any conformant cluster.…