Interview Q&A / Docker & Kubernetes

IntermediateQuick answer1 min readUpdated 3 Oct 2026

A Kubernetes Service is not routing traffic to your Pods. How do you debug it?

SHORT ANSWER

Check kubectl get endpoints for the Service. If it is empty, the Service selector does not match the Pod labels, or the Pods are not ready. Also verify targetPort matches the container port.

Explain it simply

A phone number that rings nowhere: the exchange forwards calls to a list of desks, and the list is empty. In Kubernetes that list is the Endpoints object.

Run kubectl get endpoints web (or kubectl get endpointslices). If it shows no IPs, the Service has found no ready Pods. Causes: the Service selector labels do not match the Pod labels (a typo like app: wbe); Pods are not Ready because the readiness probe fails; or the Pods are in another namespace. Compare kubectl get svc web -o yaml selector with kubectl get pods --show-labels. If endpoints exist but the connection is refused, check targetPort against the port the container really listens on, and test with kubectl exec and curl from another Pod.

Example

bash
kubectl get endpoints web
kubectl get svc web -o jsonpath='{.spec.selector}'
kubectl get pods --show-labels
kubectl run t --rm -it --image=busybox -- wget -qO- http://web

What to say in the interview

"I check kubectl get endpoints. Empty means the selector does not match Pod labels, or Pods are not ready. Otherwise I verify targetPort and test from inside the cluster with a temporary Pod."

Common mistakes

  • Fixing the Pod label but forgetting readiness probes also gate endpoints.

#kubernetes#service#debugging

Related questions

Practise more Docker & Kubernetes questions

Test your recall with short answers, then return to the detailed explanations when you need context.

Open Docker & Kubernetes quick answers →

Get new questions like this by email

One short email when something new and useful lands. No spam, unsubscribe in one tap.

By subscribing you agree to the Privacy Policy.