Skip to main content
Debugging a Kubernetes Service That Won't Connect

Debugging a Kubernetes Service That Won't Connect

KU
· Founder & Chief Editor
• 8 min read•Updated •

Your pods are running, your Service exists, and nothing can reach it. Here's the exact order we check things when a Kubernetes Service goes dark.

Key takeaways

  • Check the Service's EndpointSlices first.
  • If they are empty, either no Pod matches the selector or no matching Pod is Ready.
  • If they are populated, the fault is below the Service: a wrong targetPort, an app bound to 127.0.0.1, DNS, a NetworkPolicy, or kube-proxy.

When a Kubernetes Service won't connect, run kubectl get endpointslices -l kubernetes.io/service-name=<svc> first. Empty means no Pod matches the selector or none is Ready. Populated means the fault sits below the Service: a wrong targetPort, an app bound to 127.0.0.1, DNS, a NetworkPolicy, or kube-proxy. Check those in order.

Verified against

Kubernetes 1.37 (1.37.1, released 2026-09-15), against the kubernetes.io Debug Services task, Service, DNS for Services and Pods, and Network Policies docs. Checked October 2026.

The usual report: "the API is up but nothing can hit it." The pods are green, kubectl get svc shows a ClusterIP, and curl from the frontend hangs until it times out. Almost every case falls into one of about nine buckets. Here's the path we walk, top to bottom. Don't skip steps: half the time the answer shows up two commands in and you feel silly for suspecting NetworkPolicy.

Step 1: Is the pod actually Ready?

Running is not the same as Ready. A pod can be Running with a failing readiness probe, and Kubernetes will keep it out of the Service rotation on purpose.

Terminal
kubectl get pods -l app=orders
NAME                      READY   STATUS    RESTARTS   AGE
orders-7d9f8c6b5-2xk4p    0/1     Running   0          6m

0/1 is your smoking gun. The container is up but the readiness probe is red, so this pod is not a valid backend for anything. kubectl describe pod orders-7d9f8c6b5-2xk4p and read the Events at the bottom. Usually it's a probe hitting the wrong path or port. Fix the probe, watch it flip to 1/1, then move on.

Step 2: Does the Service selector match the pod labels?

This is the single most common cause, so it's worth doing early. A Service finds its backends by matching labels. One typo and it matches nothing.

Terminal
kubectl get svc orders -o jsonpath='{.spec.selector}'
{"app":"order-service"}

kubectl get pods --show-labels | grep orders
orders-7d9f8c6b5-2xk4p   1/1   Running   0   9m   app=orders,...

Look closely: the Service selects app=order-service, the pods carry app=orders. They will never meet. Someone renamed the deployment and forgot the Service. Align them and it starts working instantly.

Step 3: Does the Service have endpoints?

This one command tells you whether steps 1 and 2 are actually fine, because the endpoint list is the ground truth of what a Service is routing to.

Terminal
kubectl get endpoints orders
NAME     ENDPOINTS   AGE
orders   <none>      12m

<none> means zero pods are backing this Service. If you got here and step 1 and 2 looked okay, you missed something in one of them. Empty Endpoints is caused by exactly two things: no pod matches the selector, or no matching pod is Ready. There is no third option. The v1 Endpoints API has been deprecated since Kubernetes 1.33, so kubectl get endpoints prints a warning on current clusters; kubectl get endpointslices -l kubernetes.io/service-name=orders gives the same answer from the API the kubernetes.io docs recommend.

When it's healthy you'll see real addresses:

Terminal
kubectl get endpoints orders
NAME     ENDPOINTS                          AGE
orders   10.244.1.37:8080,10.244.2.14:8080  12m

Now you know traffic has somewhere to go. If Endpoints are populated and it still won't connect, the problem is below the Service, not the Service itself.

Step 4: Is targetPort right?

The Service port is what clients hit. The targetPort is the port on the pod. People mix these up constantly.

Terminal
kubectl get svc orders -o jsonpath='{.spec.ports[0]}'
{"port":80,"targetPort":8080,"protocol":"TCP"}

Now confirm the container really listens on 8080. Check the Deployment's containerPort, or just ask the pod:

Terminal
kubectl exec orders-7d9f8c6b5-2xk4p -- netstat -tlnp
tcp   0   0   0.0.0.0:3000   0.0.0.0:*   LISTEN   1/node

The app is on 3000, the Service points at 8080. Traffic arrives at a closed port and hangs. Fix targetPort to 3000.

Step 5: Is the app bound to 0.0.0.0, not 127.0.0.1?

That netstat line above is doing double duty. Look at the address, not just the port. 0.0.0.0:3000 means the app accepts connections on every interface. If instead you see 127.0.0.1:3000, the app only listens on loopback, and nothing outside the container, including kube-proxy, can reach it.

This bites people running frameworks with a default localhost bind. Node, Flask, Rails all do it. The fix is in the app config: bind to 0.0.0.0. No amount of Kubernetes YAML will route around a loopback bind.

Step 6: Can you curl it from another pod?

Endpoints look good, ports line up, the app is on 0.0.0.0. Time to test the actual path. Get a shell inside the cluster and try it.

Terminal
kubectl run tmp --rm -it --image=nicolaka/netshoot -- bash
tmp:~# curl -v http://orders.default.svc.cluster.local

Try three targets in order and note which one works:

  • The pod IP directly (10.244.1.37:8080). If this fails, the problem is the pod or the app, not the Service.
  • The ClusterIP. If the pod IP works but ClusterIP doesn't, suspect kube-proxy or a port mismatch (Kubernetes networking deep dive).
  • The DNS name. If ClusterIP works but the name doesn't, it's DNS.

This split is the whole game. It tells you which layer to blame instead of flailing across all of them.

Step 7: Is DNS resolving?

From that same netshoot pod:

code
tmp:~# nslookup orders.default.svc.cluster.local
** server can't find orders.default.svc.cluster.local: NXDOMAIN

The format is service.namespace.svc.cluster.local. A frequent miss is calling a Service in another namespace by short name; orders only resolves inside the Service's own namespace. If everything NXDOMAINs, check CoreDNS itself: kubectl get pods -n kube-system -l k8s-app=kube-dns and look at its logs. A crashlooping CoreDNS takes the whole cluster's name resolution with it; our Kubernetes DNS resolution guide covers that failure in depth.

Step 8: Is a NetworkPolicy blocking you?

If pod-IP curl works but only from some pods, you likely have a NetworkPolicy.

Terminal
kubectl get networkpolicy
NAME            POD-SELECTOR   AGE
default-deny    <none>         30d

A default-deny policy with no matching ingress rule silently drops traffic. There's no error, no reset, just a hang that looks exactly like a routing problem. Read the policy and confirm your client's labels are allowed. This is the sneakiest item on the list because everything above it looks perfect.

Step 9: kube-proxy and the NodePort/LoadBalancer edge

If ClusterIP works internally but an external NodePort or LoadBalancer doesn't, you've moved to a different layer. NodePort needs the node's firewall or cloud security group to allow that high port (the default --service-node-port-range is 30000 to 32767). LoadBalancer adds a cloud provisioning step that can quietly fail; kubectl describe svc shows <pending> on the external IP when the controller can't provision. And if ClusterIP is broken cluster-wide, check whether kube-proxy is healthy on the nodes: kubectl get pods -n kube-system -l k8s-app=kube-proxy. A dead kube-proxy means stale iptables and no ClusterIP routing at all.

The decision tree

Run it in this order and stop at the first failure:

  1. Pod 1/1 Ready? No: fix the readiness probe.
  2. Selector matches pod labels? No: align them.
  3. EndpointSlices populated? No: go back to 1 or 2, you missed it.
  4. targetPort matches the container's listening port? No: fix it.
  5. App on 0.0.0.0? No: fix the app's bind address.
  6. curl pod IP from another pod works? No: app problem, not Service.
  7. curl ClusterIP works? No: kube-proxy or port.
  8. DNS resolves? No: namespace suffix or CoreDNS.
  9. Only external access fails? Then it's NodePort firewall or LoadBalancer provisioning.

If Services themselves are still fuzzy, Kubernetes 101: Pods, Deployments, and Services builds one from scratch. For the wider set of cluster failures beyond connectivity, our Kubernetes troubleshooting guide covers the errors that put pods in a bad state to begin with.

Questions people ask

Why does my Kubernetes Service have no endpoints?

Only two causes exist. Either the Service selector matches no Pod labels (often after a rename), or the matching Pods are not Ready because a readiness probe fails. Compare kubectl get svc <name> -o jsonpath='{.spec.selector}' with kubectl get pods --show-labels, then check the READY column. Fix whichever is wrong and the EndpointSlice fills within seconds, with no Service restart needed.

Why can I curl the pod IP but not the Service?

The Pod and app are fine, so the break is in Service plumbing. The most common cause is a targetPort that doesn't match the port the container listens on. If the ports line up, check kube-proxy on the node (kubectl get pods -n kube-system -l k8s-app=kube-proxy), because without it no rules exist to forward ClusterIP traffic to the Pod.

Why does the Service name not resolve from another namespace?

A short name like orders only resolves inside the Service's own namespace, because the Pod's DNS search path starts with its own namespace. From elsewhere, use orders.<namespace> or the full orders.<namespace>.svc.cluster.local. If even the full name returns NXDOMAIN, check that CoreDNS Pods in kube-system are running and not crashlooping.

The call we'd make

Most of the time, the endpoint check ends the investigation before it starts. If it's empty, it's a selector or readiness issue and you never needed to think about DNS or kube-proxy. So that's our opinionated default: check EndpointSlices first, use it to decide whether the problem is above the Service or below it, and only then reach for the heavier tooling. Everything else on this list is just walking the layer the endpoint result pointed you at.

Sources

Explore topics:KubernetesDevOps
React
Share this post
Cite this article
Plain text

Kiril Urbonas (2026). Debugging a Kubernetes Service That Won't Connect. DevOpsNess. Updated 2026-11-11. https://www.devopsness.com/blog/fix-service-not-reachable

Markdown

[Debugging a Kubernetes Service That Won't Connect](https://www.devopsness.com/blog/fix-service-not-reachable) (Kiril Urbonas, DevOpsNess, updated 2026-11-11)

KU

Kiril Urbonas

Founder & Chief Editor

607 articles
View all articles by Kiril Urbonas

You might have missed

Evergreen posts worth revisiting.