Founding prices until 15 December: 30% off Pro, locked for life. See pricing

$ … Service has no endpoints

Kubernetes Service with no endpoints: why and how to fix it

The Service exists, but its selector matches no ready Pods, so connections fail.

Kubernetes

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 lab

No account needed for your first tries.

Related errors