Skip to content

Troubleshooting guide

Kubernetes Service has no endpoints: how to fix it

A Service with no endpoints has nothing to send traffic to. It is usually a label mismatch, or pods that are not ready.

3 min read11 sectionsUpdated

On this page

Key points

  • Selectors must match pod labels exactly.
  • Only ready pods become endpoints.
  • targetPort must be the port the container listens on.
  • Work inward: Ingress, Service, EndpointSlice, then pod.

What it means

A Service selects pods by label and routes to those that are ready. If none qualify, connections fail with "connection refused" or an Ingress returns 503. The Service object itself looks perfectly fine, which is why this wastes so much time.

Common causes

  • Selector and labels differ, even by a single character or a changed version label.
  • All pods failing readiness.
  • A different namespace from the one you expected.
  • Wrong targetPort: endpoints exist, but connections fail.
  • A network policy blocking the traffic.

Diagnose it

Compare the Service's selector with the actual pod labels, and then test from inside the cluster.

bash
# Endpoints, and what the Service selects
kubectl get endpointslices -l kubernetes.io/service-name=my-svc
kubectl get svc my-svc -o jsonpath='{.spec.selector}{"\n"}{.spec.ports}{"\n"}'

# Pods with those labels, and are they Ready?
kubectl get pods -l app=my-app --show-labels

# Test the Service from inside the cluster
kubectl run tmp --rm -it --image=busybox --restart=Never -- wget -qO- -T3 http://my-svc:8080/

Fixes

Correct the selector, keeping in mind that it should use only stable labels, never one that changes per release. Fix readiness if the pods are not ready. Point targetPort at the real container port, and use named ports to prevent drift. Make sure the Ingress references the right Service name and port. Check that any network policy allows traffic from the ingress controller's namespace.

A quick mental model

An Ingress finds a Service by name and port. A Service finds pods by labels. The EndpointSlice controller lists those pods that are ready, along with their IPs and ports, and traffic follows that list. Each arrow can break independently, and each one is checked with a single command, which is why working from the outside in finds the fault quickly. If endpoints exist and connections still fail, the problem is the port or a policy, not the selector. If there are none and pods look healthy, compare the labels character by character, because a mismatch produces no warning anywhere.

Catch it automatically

Alert when a Service has zero ready endpoints, and run an external uptime check through the Ingress. A failure there with healthy pods points to routing. Tracing with a service map shows which caller lost its dependency.

Frequently asked questions

Why does my Ingress return 503?

Often its backend Service has no ready endpoints. Check the EndpointSlices first.

What is the difference between port and targetPort?

port is what the Service exposes, and targetPort is what the container listens on.

Do unready pods receive traffic?

No, unless the Service sets publishNotReadyAddresses.

Check it now, free

Watch your own site and services with VitalRix

Uptime checks, APM, logs, real-user monitoring, alerts and status pages in one place. Every product has a free tier and no credit card is needed.