Interview Prep/Kubernetes/Services, Ingress and DNS

A Service has no endpoints. How do you find out why?

BeginnerScenarioServices, Ingress and DNS
Answer

Situation read → kubectl get endpoints web shows <none> and clients get connection refused or timeouts.

What I'd do →

  1. kubectl get svc web -o yaml and note spec.selector
  2. kubectl get pods --show-labels and compare labels exactly
  3. kubectl get pods -l app=web with the selector to see if any match
  4. Check the pods are Ready, since only Ready pods become endpoints
  5. Fix the selector or labels, then kubectl get endpointslices -l kubernetes.io/service-name=web

Why → Endpoints are built from pods that match the selector and pass readiness. A typo in one label is the most common cause.

Interview tip → Mention the Service targetPort mismatch as the second most common cause.

All Kubernetes questions Roadmap: Kubernetes networking, storage & scaling

More on Services, Ingress and DNS