You created a Deployment and a Service, the Pods are Running, and yet anything that calls the Service gets a connection error or a timeout. Nothing reports a problem, because nothing is broken in a way Kubernetes checks: the Service simply has no endpoints, so it has nowhere to send traffic.
A Service is a stable address plus a selector. The EndpointSlice controller keeps a list of the Pods that match the selector and are ready. kube-proxy only routes to the addresses on that list. If the list is empty, the Service is a dead end.
Everything below was run on a BrokenCluster lab machine (Kubernetes v1.37), in a namespace called shop.
First, look at the EndpointSlice
This one command tells you whether you're in this situation at all:
$ kubectl get endpointslices -l kubernetes.io/service-name=web
NAME ADDRESSTYPE PORTS ENDPOINTS AGE
web-fr468 IPv4 <unset> <unset> 8s
ENDPOINTS <unset> means no Pod made it onto the list. If you see addresses here instead, skip to the end of this guide: your problem is not the endpoints.
You may know the older kubectl get endpoints. It still works, but on current versions it warns you:
$ kubectl get endpoints web
Warning: v1 Endpoints is deprecated in v1.33+; use discovery.k8s.io/v1 EndpointSlice
NAME ENDPOINTS AGE
web 10.42.1.0:8080,10.42.2.0:8080 10s
An empty list has three common causes. Check them in this order, because the first is by far the most frequent.
Cause 1: the selector matches no Pod
Compare what the Service selects with the labels the Pods actually have:
$ kubectl describe service web
Name: web
Namespace: shop
Labels: <none>
Annotations: <none>
Selector: app=website
Type: ClusterIP
IP Family Policy: SingleStack
IP Families: IPv4
IP: 10.43.94.125
IPs: 10.43.94.125
Port: <unset> 80/TCP
TargetPort: 8080/TCP
Endpoints:
Session Affinity: None
Internal Traffic Policy: Cluster
Events: <none>
$ kubectl get pods --show-labels
NAME READY STATUS RESTARTS AGE LABELS
web-85d88d967d-4sbqc 1/1 Running 0 9s app=web,pod-template-hash=85d88d967d
web-85d88d967d-zlblv 1/1 Running 0 9s app=web,pod-template-hash=85d88d967d
The Service wants app=website; the Pods are labelled app=web. The fastest proof is to run the selector yourself:
$ kubectl get pods -l app=website
No resources found in shop namespace.
If that command returns nothing, the Service returns nothing either. Fix whichever side is wrong. Usually it's the Service, because changing Pod labels means changing the Deployment's template and its selector too:
$ kubectl patch service web -p '{"spec":{"selector":{"app":"web"}}}'
service/web patched
$ kubectl get endpointslices -l kubernetes.io/service-name=web
NAME ADDRESSTYPE PORTS ENDPOINTS AGE
web-fr468 IPv4 8080 10.42.1.0,10.42.2.0 14s
Things to watch for: a typo in a key or value, a selector with an extra label that only some Pods have (every key in the selector must be on the Pod), and a Service in a different namespace from the Pods. A Service only ever selects Pods in its own namespace.
Cause 2: the Pods are not ready
A Pod can be Running and still be kept off the list. The EndpointSlice includes it, but marks it not ready, and kube-proxy doesn't route to it. The usual reason is a readiness probe that never succeeds.
Here the Deployment got a readiness probe on port 9090, but the container only listens on 8080:
$ kubectl get pods
NAME READY STATUS RESTARTS AGE
web-6f78c458c7-ktsrd 0/1 Running 0 20s
web-85d88d967d-4sbqc 1/1 Running 0 35s
web-85d88d967d-zlblv 1/1 Running 0 35s
0/1 is the giveaway. The two old Pods are still serving because the rollout stopped at the first new Pod that never became ready. If every Pod were in that state, the Service would have nothing to route to. The full EndpointSlice shows the difference per Pod (trimmed):
$ kubectl get endpointslices -l kubernetes.io/service-name=web -o yaml
- addresses:
- 10.42.1.1
conditions:
ready: false
serving: false
terminating: false
nodeName: node01
targetRef:
kind: Pod
name: web-6f78c458c7-ktsrd
Then ask the Pod why:
$ kubectl describe pod -l app=web | grep -E 'Readiness'
Readiness: http-get http://:9090/healthz delay=0s timeout=1s period=5s successThreshold=1 failureThreshold=3
The probe checks a port nothing listens on. Point it at the real port and the Pods become ready:
$ kubectl patch deployment web --type=json -p '[{"op":"replace","path":"/spec/template/spec/containers/0/readinessProbe/httpGet/port","value":8080}]'
deployment.apps/web patched
$ kubectl get pods
NAME READY STATUS RESTARTS AGE
web-5fb84f4549-qhdhx 1/1 Running 0 20s
web-5fb84f4549-rnvkg 1/1 Running 0 20s
$ kubectl get endpointslices -l kubernetes.io/service-name=web
NAME ADDRESSTYPE PORTS ENDPOINTS AGE
web-fr468 IPv4 8080 10.42.1.1,10.42.2.1 57s
Other reasons a Pod is not ready: the probe path returns an error, the app takes longer to start than the probe allows, or the Pod is still Pending or crash-looping. kubectl describe pod shows each of these in its conditions and events.
Cause 3: there are no Pods
The simplest one, and easy to miss when you're looking at the Service:
$ kubectl scale deployment web --replicas=0
deployment.apps/web scaled
$ kubectl get endpointslices -l kubernetes.io/service-name=web
NAME ADDRESSTYPE PORTS ENDPOINTS AGE
web-fr468 IPv4 <unset> <unset> 66s
$ kubectl get deployment web
NAME READY UP-TO-DATE AVAILABLE AGE
web 0/0 0 0 66s
In practice it's rarely a deliberate scale 0. More often the Pods can't be created at all: a quota or admission policy rejects them, the image can't be pulled, or no node can schedule them. Check kubectl get deployment and kubectl get events in the namespace.
When endpoints exist but it still fails
If the EndpointSlice lists addresses and clients still can't connect, the Service is finding the Pods and the problem is further along:
- targetPort doesn't match the port the container listens on. The Service accepts on
portand forwards totargetPort; check both against the container'scontainerPort. - A NetworkPolicy in the namespace doesn't allow traffic from the client.
- The client uses the wrong name. From another namespace, the Service is
web.shop, notweb.
The checklist
kubectl get endpointslices -l kubernetes.io/service-name=<svc>: empty or not?kubectl get pods -l <the Service's selector>: does the selector find Pods?kubectl get pods: are they1/1, or0/1(readiness)?kubectl get deployment: are there any Pods at all?
Reading about it is half the work. The labs below give you a cluster where one of these is already wrong, and nothing else: find which one and fix it.
Questions
- Does a Service with no endpoints show an error?
- No. The Service is valid and has a ClusterIP, so kubectl reports nothing wrong. Clients get connection errors or timeouts, and the only sign on the Service itself is an empty Endpoints line in kubectl describe and an EndpointSlice with no addresses.
- Should I use kubectl get endpoints or EndpointSlices?
- EndpointSlices. Since Kubernetes v1.33 the v1 Endpoints API is deprecated and kubectl prints a warning when you read it. Use kubectl get endpointslices -l kubernetes.io/service-name=<service>.
- Does the selector have to match every label on the Pod?
- No, the other way round. Every key=value in the Service's selector must be on the Pod; the Pod may have more labels. A selector with one wrong value matches nothing.
- My endpoints are listed but connections still fail. What now?
- Then the Service finds the Pods, and the problem is elsewhere: usually targetPort doesn't match the port the container listens on, or a NetworkPolicy blocks the traffic.
Fix it yourself
A live machine in your browser, already broken. The grader checks the result.
- Fix a Service With No Endpointseasy 6 min
- Running, but Never Readymedium 8 min
- Add Readiness and Liveness Probesmedium 8 min
No account needed for your first tries.
More guides
- CKA in 2026: what the exam tests, how it works, and a free mock to try
Two hours, 15 to 20 hands-on tasks on Kubernetes v1.37, 66% to pass. The five domains, how the exam terminal works, and how to practise for it.
- sudo echo >> /etc/hosts: Permission denied. Why sudo didn't help
sudo runs the command as root, but the >> redirect is done by your own shell, before sudo starts. Here's why, and the three correct ways to write the file.
- I added the file to .gitignore and Git still tracks it
.gitignore only applies to files Git isn't tracking yet. Here's how to untrack a file without deleting it, and what happens to your teammates when they pull.