Bird
0
0

You created a headless service but your pods are not reachable via DNS. What is a likely cause?

medium📝 Troubleshoot Q14 of 15
Kubernetes - Services
You created a headless service but your pods are not reachable via DNS. What is a likely cause?
AYou forgot to set clusterIP: None in the service spec
BYour pods do not have matching labels for the service selector
CYou used type: LoadBalancer instead of clusterIP: None
DYou exposed the service with NodePort instead of ClusterIP
Step-by-Step Solution
Solution:
  1. Step 1: Check service selector and pod labels

    If pods do not match the service selector labels, the service cannot route traffic to them.
  2. Step 2: Verify clusterIP and service type correctness

    clusterIP: None is required for headless service; type LoadBalancer or NodePort changes service behavior but won't cause DNS pod reachability issues if labels match.
  3. Final Answer:

    Your pods do not have matching labels for the service selector -> Option B
  4. Quick Check:

    Selector mismatch = pods unreachable [OK]
Quick Trick: Check pod labels match service selector [OK]
Common Mistakes:
  • Ignoring pod labels and selector mismatch
  • Confusing service type with label issues
  • Assuming NodePort affects headless DNS reachability

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Kubernetes Quizzes