What it means
A Service sends traffic to the endpoints Kubernetes builds from its label selector: the IPs of matching Pods that are ready. No endpoints means requests get "connection refused" or time out.
Causes and fixes
Most likely first. Run the check, and if it matches, apply the fix.
1. The selector doesn't match the Pods' labels (a typo, or labels changed)
Check:
kubectl get endpoints <svc>
kubectl get svc <svc> -o jsonpath='{.spec.selector}'
kubectl get pods --show-labels
Fix: Edit the Service selector (kubectl edit svc <svc>) to match the Pod template's labels.
2. The Pods are running but not ready (failing readiness probe)
Check:
kubectl get pods # READY 0/1
Fix: Fix the readiness probe or what it checks; unready Pods are left out on purpose.
3. The Pods are in a different namespace (a selector only matches Pods in the Service's own namespace)
Check:
kubectl get svc <svc> -n <ns>
kubectl get pods -A --show-labels | grep <label>
Fix: Create the Service in the Pods' namespace (or move the workload). Note that a wrong targetPort is a different problem, endpoints exist but connections are refused.
The long version, step by step: Kubernetes Service has no endpoints: the 3 causes and how to check each
Fix it yourself
A live machine in your browser with this problem already on it. The grader checks the result.
Open the labNo account needed for your first tries.
Related errors
- Readiness probe failed: HTTP probe failed with statuscode: 503
The Pod runs but reports not ready, so it's removed from the Service.
- 503 Service Temporarily Unavailable (ingress-nginx)
The ingress controller has no healthy backend for the route, or no rule matches the request.