⚡ ~/naveed Interview Prep
⚡ Portfolio Home 👤 About Naveed Bio & Credentials 📫 Contact Naveed Get In Touch ✍️ Engineering Blog Deep Dives 🎯 Interview Hub 1,000+ Scenarios ☸️ Kubernetes Mastery Hub 24 Modules 🎮 DevOps Arcade & Quizzes Subnet Blitz ⚡ 🗺️ DevOps Roadmaps PDFs & Guides 🤖 Morpheus Analysis AI Quant ↗ 🛠️ Developer Tools Utilities 🧪 Labs & Experiments 📄 Interactive CV & Certs 🔗 All Links & Socials ⚡ Join The Dispatch (Weekly SRE Newsletter) →
← Back to All Kubernetes Interview Questions Scenario 4 of 207 in Kubernetes
Senior DevOps / SRE Kubernetes Services & Networking Core K8s Scenario
🎯 Target Role / Context: Kubernetes Networking & Service Mesh

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 #Endpoints #CoreDNS #NetworkPolicy #kube-proxy
🎙️ Candidate Opening & Architectural Context
"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."
Advertisement
⚡ Recommended Practice Lab

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.

1️⃣

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> and kubectl get endpointslices -l kubernetes.io/service-name=<service-name>.
  • If Endpoints is <none>: The Service's spec.selector does NOT match the Pod's labels! Compare kubectl get svc <svc> -o yaml against kubectl get pods --show-labels.
  • Common typos: app: web in service vs app: frontend or tier: web on pod.
2️⃣

Step 2: Check Pod Readiness Probes

A pod can be 'Running' but failing its readiness probe:

  • Check kubectl get pods: Is the pod showing 0/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 pod for readiness probe failures.
Advertisement
3️⃣

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 -tulpn or curl localhost:8080.
  • If targetPort is a named port (e.g. http), verify containerPort: 8080 in pod spec matches the name.
4️⃣

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.
💡 The Senior SRE Gold Nugget (Key Architectural Takeaway)
"Always check 'kubectl get endpoints <svc>' first. If endpoints are empty, it's either a label selector mismatch or a failing readiness probe. Then test port mappings and NetworkPolicies."
⚡ 60-Second Elevator Pitch Talking Points
  • 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.
🎬 60-Second Video Walkthrough
Watch the Animated Breakdown & Practice Live

Mastered this procedure? Subscribe to @naveedkumbhar01 on YouTube for daily 60-second SRE incident runbooks, Kubernetes triage shortcuts, and high-impact interview elevator pitches.

🔔 Subscribe on YouTube (Free) ▶ Watch Short (60s) ↗
⛔ Critical Candidate Mistakes to Avoid in This Scenario

Senior hiring managers and bar raisers evaluate how you prioritize during outages. Avoid these common anti-patterns:

  1. Overlooking CoreDNS query amplification caused by high ndots search path configurations Default ndots:5 triggers multiple sequential failed DNS lookups for external domains against cluster local search paths, overloading CoreDNS.
  2. 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.
  3. Confusing Service exposure ports with container targetPort definitions in Kubernetes manifests Mismatched ports forward traffic to unlistening container ports, resulting in immediate connection refused errors.
  4. 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.
Advertisement
📥 FREE DOWNLOAD · 101-PAGE COMPANION HANDBOOK
Studying for Kubernetes & SRE Technical Rounds?
Download the complete 100-question PDF field guide covering all 11 core modules with offline diagnostic runbooks.
📥 Download PDF (Free) Read Online Guide →
Want more Kubernetes scenarios?
Explore our complete collection of scenario-based Kubernetes interview runbooks.
Browse All Kubernetes Questions →