Kubernetes: Service has no endpoints
An empty Endpoints list means the selector or port names do not match a ready pod. Compare labels, check targetPort, and confirm readiness probes pass.

Introduction & Quick Summary
A Service exists, pods are running, and the address refuses connections:
$ kubectl get endpoints web
NAME ENDPOINTS AGE
web <none> 14m
$ kubectl describe svc web
Selector: app=web-frontend
Port: http 80/TCP
TargetPort: http/TCP
Endpoints: <none>Quick answer: a Service forwards traffic only to pods that match its selector and are Ready, on a port the pod actually exposes. With <none> endpoints there is no backend to route to, so the virtual IP drops or refuses every request.
Work the four checks in order:
kubectl get svc web -o jsonpath='{.spec.selector}{"\n"}'
kubectl get pods -n default -l app=web-frontend -o wide
kubectl get endpointslice -l kubernetes.io/service-name=web -o wide
kubectl get pod <pod> -o jsonpath='{.status.conditions[?(@.type=="Ready")].status}{"\n"}'Whichever command comes back empty or False is the broken link. In practice the order is: no pod matches the selector, pods match but are not Ready, or the pod is Ready but the port name does not resolve.
This guide explains how a Service gets its endpoints, the five conditions a pod must satisfy to appear in an EndpointSlice, and the debugging sequence that finds the broken link in one pass instead of guessing.
Core Mechanics, Signatures & Reproducible Setup
A ClusterIP Service is not a process. It is a virtual address programmed into each node's packet filter, and the rules are generated from EndpointSlice objects that controllers maintain. kube-proxy (or the CNI's eBPF replacement) watches slices and rewrites traffic for ClusterIP:port to one of the listed pod IPs.
An EndpointSlice contains an entry for a pod only when all of these hold:
- The pod's labels match every key and value in
spec.selector. - The pod is in the same namespace as the Service.
- The pod has an IP address and is not terminated.
- The pod is Ready, unless the Service sets
publishNotReadyAddresses: true. - For a named
targetPort, the pod declares a container port with that name.
A minimal working pair:
apiVersion: v1
kind: Service
metadata:
name: web
spec:
selector:
app: web-frontend # must match the pod label exactly
ports:
- name: http
port: 80 # what clients call
targetPort: http # container port name, or a number
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: web
spec:
selector:
matchLabels: { app: web-frontend }
template:
metadata:
labels: { app: web-frontend }
spec:
containers:
- name: web
image: nginx:1.27-alpine
ports:
- name: http
containerPort: 80
readinessProbe:
httpGet: { path: /, port: http }Reproduce the empty-endpoint state by changing one label:
kubectl apply -f web.yaml
kubectl get endpoints web # 10.244.x.x:80
kubectl patch svc web -p '{"spec":{"selector":{"app":"web"}}}'
kubectl get endpoints web # <none>
kubectl describe endpointslice -l kubernetes.io/service-name=webThe slice controller does not guess. A selector that matches nothing produces an empty slice and no warning, and the Service keeps its ClusterIP.
Key Comparison Table
| Check | Command | Healthy result |
|---|---|---|
| Selector matches pods | kubectl get pods -l app=web-frontend | at least one Running pod |
| Pod is Ready | kubectl get pod -o wide / describe | READY 1/1 |
| EndpointSlice exists | kubectl get endpointslice -l kubernetes.io/service-name=web | one or more addresses |
| Named port resolves | kubectl get pod -o jsonpath='{.spec.containers[*].ports}' | port named http |
| DNS resolves | kubectl run tmp --rm -it --image=busybox -- nslookup web | the ClusterIP |
| Symptom | Cause | Fix |
|---|---|---|
<none> endpoints, pods running | label typo or different namespace | correct the selector or the pod label |
<none> endpoints, pods 0/1 | readiness probe failing | fix the probe path, port or timing |
| Endpoints listed, connection refused | targetPort points at a closed port | align container port and app listen address |
| Endpoints listed, timeout | NetworkPolicy or wrong Service port | allow the traffic, check port |
| Works in one namespace only | Service selector is namespace-scoped | deploy the Service beside the pods |
| Service kind | Gets endpoints from | Notes |
|---|---|---|
| ClusterIP with selector | EndpointSlice controller | the default case |
Headless (clusterIP: None) | same controller, per-pod DNS | clients resolve pod IPs directly |
| ExternalName | none | CNAME only, no proxying |
| No selector | manual EndpointSlice | you own the addresses |
Practical Edge Cases, Error Fixes & Deep Dive Code Examples
1. Selector typos and namespace drift
app: web-frontend does not match app: web or app.kubernetes.io/name: web-frontend. Compare the two objects directly instead of reading YAML by eye:
kubectl get svc web -o jsonpath='{.metadata.namespace} {.spec.selector}{"\n"}'
kubectl get pods -A -l app=web-frontend --show-labels-A is the important flag: a Service in default cannot select pods in staging, and the two namespaces often hold identical Deployments during a migration.
2. Readiness probes keep a pod out of the slice
A Running pod with 0/1 Ready contributes no endpoint. describe pod shows the probe error, and the events show repeated Readiness probe failed:
readinessProbe:
httpGet: { path: /healthz, port: 8080 }
initialDelaySeconds: 5
periodSeconds: 5
failureThreshold: 3Use a path that does not depend on the database if the goal is only "process is up"; otherwise a database blip removes every endpoint at once and the Service goes from healthy to <none> during an unrelated incident. publishNotReadyAddresses: true is the deliberate exception, and it is right mainly for peer-discovery Services such as a database cluster's headless entry.
3. targetPort and named ports
A numeric targetPort that no container listens on yields endpoints but refused connections, because the pod IP is routable and nothing is bound:
ports:
- port: 80
targetPort: 8080 # container must listen on 8080, not 80For named ports, the name must exist in the pod spec, be unique per pod, and stay within 15 characters:
# Service
targetPort: http
# Pod
ports: [{ name: http, containerPort: 8080 }]A pod that listens on 127.0.0.1:8080 also produces this symptom: the IP is reachable but the socket is bound to loopback only. Bind to 0.0.0.0 inside containers.
4. Endpoints, EndpointSlices, and where to look
kubectl get endpoints still works but mirrors a deprecated API. The controller writes EndpointSlices, and each carries the readiness and topology data:
kubectl get endpointslice -l kubernetes.io/service-name=web -o yaml | \
grep -E 'addresses|ready|conditions|ports' -A2If slices list addresses but traffic still fails, the problem has moved past service discovery: check kube-proxy logs on the node, NetworkPolicy, and whether the client is in a namespace with an egress policy.
kubectl -n kube-system logs -l k8s-app=kube-proxy --tail=50
kubectl run tmp --rm -it --image=nicolaka/netshoot -- curl -sv http://web.default.svc.cluster.local5. Services without selectors
Batch jobs, external databases and migration targets often use a Service with no selector and a hand-written slice. Nothing populates it automatically, so it stays empty until you write one:
apiVersion: discovery.k8s.io/v1
kind: EndpointSlice
metadata:
name: legacy-db-1
labels: { kubernetes.io/service-name: legacy-db }
addressType: IPv4
ports: [{ name: postgres, port: 5432 }]
endpoints:
- addresses: ["10.0.5.20"]
conditions: { ready: true }Once the slice exists, kubectl get endpoints legacy-db shows the address, and a wrong port here produces a connection refused that looks like a Service bug.
6. Headless services and per-pod DNS
With clusterIP: None there is no virtual IP, and clients resolve web.default.svc.cluster.local to the pod IPs directly. A StatefulSet's stable names (web-0.web.default.svc.cluster.local) require publishNotReadyAddresses for bootstrap, because a peer that is not Ready still needs to be discoverable while the cluster forms.
The curl tool documents how to reproduce the exact request from inside a pod, including the -v and --resolve flags that separate DNS from routing, and the JSON formatter makes a long -o json dump of a Service readable.
Common Compilation/Runtime Mistakes & Version Gotchas
- Reading only
kubectl get pods. Running is not Ready; the endpoint decision uses the Ready condition. - Changing the Service instead of the selector owner. Editing a Service's selector to match a typo fixes one object and leaves the Deployment inconsistent.
- Expecting a Service to load-balance to pods in another namespace. Selectors do not cross namespaces.
- Using
portwheretargetPortbelongs.portis what clients call;targetPortis where the container listens. - Ignoring dual-stack. A single-stack Service in a dual-stack cluster gets one family of endpoints; a client on the other family sees timeouts.
- Kubernetes 1.33 and later. The
EndpointsAPI is deprecated in favour of EndpointSlices; tooling that reads/api/v1/endpointsmay lag behind the actual routing state. - Assuming NetworkPolicy is the culprit first. With
<none>endpoints, policy never comes into play; fix discovery before debugging packet filters.
Official documentation: Service and endpoint semantics and Debugging Services.
Official references
primary documentationThe Kubernetes documentation that defines the behaviour this guide explains.
Try matching browser tools
All toolsSmall utilities that fit Kubernetes work — they run entirely in this browser tab, so nothing you paste leaves your device.
Related Kubernetes guides
All Kubernetes guidesKubernetes 1.35: kubelet will not start on a cgroup v1 node
A 1.35 kubelet refuses a cgroup v1 host, and the removed pod-infra flag stops custom images. Check the kernel command line before the node pool.
Kubernetes: x509 certificate has expired or is not yet valid
kubeadm control plane certificates last one year. Renew them, restart the static pods, refresh kubeconfigs, and alert before the next expiry.
kubectl: metadata.resourceVersion: Invalid value: 0x0
The 0x0 error means an update carried no resourceVersion. Switch to apply or patch, or read the live object first, and keep versions out of Git.
no matches for kind in version: removed APIs and missing CRDs
kubectl cannot map the manifest to an endpoint. Either the API version was removed or the CRD is absent, and discovery tells you which.
More in Kubernetes
All Kubernetes guidesThe guides filed next to this one in Kubernetes, in library order.