← Back to all fixes

Service is not reachable inside the cluster

The Issue

Pod A tries to curl `http://my-service:8080` but gets connection refused or no route to host.

Root Cause

Possible causes: Service selector does not match pod labels, wrong targetPort, no running pods backing the service, or CoreDNS issue.

How to Fix
  1. Verify the service has endpoints: `kubectl get endpoints my-service` — if empty, selector is wrong
  2. Check label match: compare `kubectl get svc my-service -o yaml` selector with `kubectl get pods --show-labels`
  3. Test DNS resolution from inside a pod: `kubectl run tmp --image=busybox --rm -it -- nslookup my-service`
  4. Verify the targetPort matches the port your app listens on inside the container
  5. Check if backing pods are Running: `kubectl get pods -l app=my-service`