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 →
kubectl get svc web -o yamland notespec.selectorkubectl get pods --show-labelsand compare labels exactlykubectl get pods -l app=webwith the selector to see if any match- Check the pods are Ready, since only Ready pods become endpoints
- 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.
More on Services, Ingress and DNS
When do you use ClusterIP, NodePort, LoadBalancer and ExternalName?BeginnerTraffic to a Service works from some pods but times out from others. How do you debug it?AdvancedYou want to expose three HTTP services under one hostname with different paths. How?Intermediateingress-nginx returns 404 for a new host. What do you check?Intermediateingress-nginx returns 502 or 503 intermittently. What are the likely reasons?IntermediateA pod cannot resolve `my-svc` but can reach the pod IP. What do you test first?Beginner