Skip to main content
All of the catalog
Injectable fault

Service selector mismatch: empty endpoints

The pager says go-api's Service has no ready endpoints, and every request through the ingress is a 503. But every pod is Running and Ready and nothing was deployed. The Service exists. The pods exist. They just don't know about each other anymore.

ConfigMedium severitygo-api/go-api
Definition on GitHub

Which app it breaks

go-api by default. Pass --app to break another app in your lab instead.

The hint ladder

Each hint narrows the search a little further. They are collapsed on purpose: open one only when you are properly stuck, because working out the next command yourself is the whole exercise.

Hint 1

The page named the Service, not a pod, and 503 from an ingress usually means it had nowhere to send the request. Pods look fine, so check the layer between ingress and pods. Is the Service actually fronting anything?

Hint 2

kubectl get endpoints go-api -n go-api: <none>. A Service with no endpoints matches no pods. Endpoints come from the Service's selector matching pod labels. Compare them.

Hint 3

kubectl get svc go-api -n go-api -o jsonpath='{.spec.selector}' vs kubectl get pods -n go-api --show-labels. They disagree on app.kubernetes.io/name: the Service is looking for a value the pods do not carry, and a selector is an AND, so one wrong key matches nothing.

Fix it on the Service, not the pods. Relabelling a pod to match makes the 503s stop and leaves the Deployment still stamping the other label on every pod it creates, so the next rollout breaks it again.

Get updates

New scenarios and faults, release notes, and news about hosted labs if and when there is some. A few emails a month at most.

We'll email you about new releases, new lab content and paid offerings such as hosted labs, courses and workshops. Unsubscribe any time.