Bird
0
0

A Kubernetes Service is defined but clients receive connection refused errors. Which YAML misconfiguration is the most probable cause?

medium📝 Troubleshoot Q7 of 15
Kubernetes - Services
A Kubernetes Service is defined but clients receive connection refused errors. Which YAML misconfiguration is the most probable cause?
AThe Service port is missing in the YAML definition
BThe Service type is set to NodePort instead of ClusterIP
CThe Service selector labels do not match any pod labels
DThe Service metadata name is invalid
Step-by-Step Solution
Solution:
  1. Step 1: Check Service selector

    The selector must match pod labels exactly for the Service to route traffic.
  2. Step 2: Impact of mismatched selector

    If no pods match, the Service has no endpoints, causing connection refused errors.
  3. Final Answer:

    The Service selector labels do not match any pod labels -> Option C
  4. Quick Check:

    Selector mismatch leads to no endpoints [OK]
Quick Trick: Selector must match pod labels exactly [OK]
Common Mistakes:
  • Using incorrect or missing selectors
  • Confusing Service types with connectivity issues
  • Omitting Service ports

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Kubernetes Quizzes