Kubernetes Networking
15 min
Day 59: CoreDNS — cluster DNS resolution
How Pods find Services by name
CoreDNS runs as the cluster's internal DNS server, giving every Service a predictable DNS name: <service>.<namespace>.svc.cluster.local (often just <service> works within the same namespace). This is the exact same recursive-resolution concept from Phase 2, Day 18, scoped to a cluster instead of the whole internet.
Resolving a Service from inside a Pod
kubectl exec -it some-pod -- nslookup api.default.svc.cluster.local
# or, from within the same namespace:
kubectl exec -it some-pod -- curl http://api/healthKey terms
- CoreDNS
- Kubernetes's internal DNS server, resolving Service names to their ClusterIP.
A Pod in namespace "staging" needs to reach a Service named "cache" in namespace "prod". What's the correct hostname?