Interview Prep/Kubernetes/Services, Ingress and DNS

What is a headless Service and where do you use it?

BeginnerScenarioServices, Ingress and DNS
Answer

Situation read → A StatefulSet needs stable DNS names for each pod.

What I'd do →

  1. Set clusterIP: None on the Service
  2. Reference it as serviceName in the StatefulSet
  3. Each pod gets pod-0.svc.ns.svc.cluster.local
  4. Verify with nslookup svc which returns pod IPs rather than a virtual IP
  5. Use for databases, Kafka, and clients that do their own load balancing

Why → A headless Service skips the virtual IP and returns DNS A records of the pods, giving stable identities.

Interview tip → Mention that gRPC clients need headless or a mesh because ClusterIP balances per connection.

All Kubernetes questions Roadmap: Kubernetes networking, storage & scaling

More on Services, Ingress and DNS