Q: Pod is running but Service isn't accessible — what's your approach?
Systematic networking approach for when pods report Running/Ready but the Kubernetes ClusterIP/NodePort/LoadBalancer Service cannot be reached.
Kubernetes Service Not Accessible? Check This First!
Watch Naveed break down how to troubleshoot Kubernetes Service connectivity when pods are running—checking EndpointSlices, selector label mismatches, readiness probes, port vs targetPort alignment, and NetworkPolicies in 60 seconds.
- Check EndpointSlices and endpoints first: verify spec.selector matches Pod labels
- Inspect Pod readiness: failing probes silently strip Pod IPs from Service endpoints
- Verify port vs targetPort mapping against actual container listening port (ss -tulpn)
- Isolate CNI and CoreDNS: test direct Pod IP, ClusterIP, and NetworkPolicy ingress rules
Want to master this scenario in a live sandbox? KodeKloud's CKA & CKAD Hands-On Certification Track covers this exact problem with hands-on terminal drills.
🛠️ Production Runbook & Step-by-Step Resolution
Direct Answer: When a Pod is Running but its Service isn't accessible, I isolate the failure across 5 discrete layers: Service Selector/Endpoints -> Port mapping -> Readiness probes -> Cluster DNS -> NetworkPolicies.
Step 1: Check Endpoints & EndpointSlices (The #1 Culprit)
Services do not route to Pods directly; they route to Endpoints populated by label matching:
- Run:
kubectl get endpoints <service-name>andkubectl get endpointslices -l kubernetes.io/service-name=<service-name>. - If Endpoints is <none>: The Service's
spec.selectordoes NOT match the Pod's labels! Comparekubectl get svc <svc> -o yamlagainstkubectl get pods --show-labels. - Common typos:
app: webin service vsapp: frontendortier: webon pod.
Step 2: Check Pod Readiness Probes
A pod can be 'Running' but failing its readiness probe:
- Check
kubectl get pods: Is the pod showing0/1 READY? - If a readiness probe fails, Kubernetes removes the pod's IP from the Service Endpoints to prevent traffic from hitting unready pods.
- Check
kubectl describe podfor readiness probe failures.
Step 3: Verify Port & TargetPort Mapping
Confirm the port translation pipeline:
port: 80: The port clients connect to on the Service ClusterIP.targetPort: 8080: The port the container is actually listening on.- Verify the app is listening inside the container:
kubectl exec -it <pod> -- ss -tulpnorcurl localhost:8080. - If
targetPortis a named port (e.g.http), verifycontainerPort: 8080in pod spec matches the name.
Step 4: Test In-Cluster DNS & NetworkPolicies
Spin up a temporary debug pod inside the cluster:
kubectl run curl-test --rm -it --image=curlimages/curl -- sh- Test by IP first:
curl -Iv http://<ClusterIP>:<port>. If IP works, problem is CoreDNS resolution. - Test by FQDN:
curl -Iv http://<service>.<namespace>.svc.cluster.local:<port>. - Check NetworkPolicies: Run
kubectl get netpol. If an ingress default-deny NetworkPolicy exists on the namespace without an allow rule for the client, all traffic is dropped silently at the CNI layer.
- Check Endpoints: 'kubectl get endpoints <svc>'. If empty, Service selector doesn't match Pod labels.
- Check Readiness: If pod is 0/1 READY, failing readiness probe stripped pod IP from endpoints.
- Check Port Translation: Verify service port -> targetPort matches the port the container is listening on (ss -tulpn).
- Test via curl container: Test ClusterIP directly, then FQDN (service.ns.svc.cluster.local) to rule out CoreDNS.
- Check NetworkPolicies: 'kubectl get netpol -n <ns>' - verify ingress allow rules exist between namespaces.
Mastered this procedure? Subscribe to @naveedkumbhar01 on YouTube for daily 60-second SRE incident runbooks, Kubernetes triage shortcuts, and high-impact interview elevator pitches.
Senior hiring managers and bar raisers evaluate how you prioritize during outages. Avoid these common anti-patterns:
-
Overlooking CoreDNS query amplification caused by high ndots search path configurations
Default
ndots:5triggers multiple sequential failed DNS lookups for external domains against cluster local search paths, overloading CoreDNS. - Applying restrictive NetworkPolicies that block CoreDNS egress UDP/TCP port 53 lookups Blocking egress DNS traffic prevents pods from resolving internal cluster services or external database endpoints.
-
Confusing Service exposure ports with container targetPort definitions in Kubernetes manifests
Mismatched ports forward traffic to unlistening container ports, resulting in immediate
connection refusederrors. - Ignoring MTU packet size mismatches between physical host interfaces and CNI overlay encapsulation Overlay encapsulation headers (VXLAN/Geneve) exceed standard MTU without proper clamping, causing silent packet drops on large TCP payloads.