DevOps · Flashcard

A developer creates a Service targeting Pods with label 'app: backend', but the Service returns no endpoints. Running 'kubectl get endpoints my-service' shows an empty list. The Pods are running and healthy. What is the most likely cause?

  • AThe Service selector does not match the Pods' labels: one of them is misspelled, and selectors match exactly
  • BThe Service sits in a different namespace, and cross-namespace routing needs an opt-in annotation on the Pods
  • CThe Pods are running but not Ready, and a Service ignores Pods for their first 30 seconds
  • Dkube-proxy has not synced yet, and a new Service has a mandatory five-minute propagation delay

Why this is the answer

The most common cause of empty endpoints is a label selector mismatch. The Service's spec.selector must exactly match the labels on the target Pods. Even a subtle difference (dash vs underscore, different capitalization) causes a complete mismatch. Debug with 'kubectl get pods --show-labels' and compare against 'kubectl get svc -o yaml'. Services do require Pods to be Ready, but this wouldn't result in zero endpoints unless all Pods are unready.

Official docs
Study in Gnoseed →