Interview Prep/Networking/Kubernetes Networking

How does a pod find another service by name?

BeginnerScenarioKubernetes Networking
Answer

Situation read → CoreDNS gives every Service a DNS name.

What I'd do →

  1. The name is <service>.<namespace>.svc.cluster.local, and within the same namespace <service> is enough
  2. The pod's /etc/resolv.conf points to the CoreDNS ClusterIP and has search domains
  3. Test: kubectl exec -it pod -- nslookup my-svc.prod
  4. Headless services return pod IPs directly

Why → Search domains in resolv.conf allow short names to expand to the full service FQDN.

Interview tip → Mention cross-namespace needs at least svc.namespace.

All Networking questions Roadmap: Networking for DevOps

More on Kubernetes Networking