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
Diagnose it
Compare the Service's selector with the actual pod labels, and then test from inside the cluster.
# 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.
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
- Website down checker: Is it down for everyone or just me? Check any site now.
Related reading
- Kubernetes pod stuck in Pending: how to fix it: Fix Kubernetes pods stuck in Pending: insufficient CPU or memory, taints, node selectors and unbound PersistentVolumeClaims, using scheduler events.
- Kubernetes pod stuck in Terminating: how to fix it: Fix pods stuck in Terminating: finalizers, unreachable nodes, stuck volumes and processes that ignore SIGTERM, and when force deletion is safe to use.
- ERR_SSL_VERSION_OR_CIPHER_MISMATCH: how to fix it: Fix ERR_SSL_VERSION_OR_CIPHER_MISMATCH: old TLS versions, weak ciphers, missing certificates for a host name and CDN SSL settings, with server configs.
- Error 503 Backend fetch failed (Varnish): how to fix it: Fix "Error 503 Backend fetch failed" from Varnish and Fastly: unhealthy backends, timeouts, oversized headers and probe settings, with varnishlog commands.
- Kubernetes HPA not scaling: how to fix it: Fix a Kubernetes HorizontalPodAutoscaler that will not scale: unknown metrics, missing CPU requests, metrics-server issues, tolerance and stabilization windows.
- Kubernetes ImagePullBackOff: causes and how to fix it: Fix ImagePullBackOff and ErrImagePull in Kubernetes: wrong tags, private registry credentials, rate limits and network problems, with kubectl commands.
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.