Bird
0
0

You have a service named backend exposing pods on port 8080. A pod tries to connect using curl http://backend:80 but gets a connection refused error. What is the likely cause?

medium📝 Troubleshoot Q14 of 15
Kubernetes - Networking

You have a service named backend exposing pods on port 8080. A pod tries to connect using curl http://backend:80 but gets a connection refused error. What is the likely cause?

AThe service port is 8080, but curl uses port 80
BThe service selector does not match any pods
CThe pod network is not enabled
DThe service type is NodePort instead of ClusterIP
Step-by-Step Solution
Solution:
  1. Step 1: Check service port configuration

    The service exposes port 8080, but the curl command targets port 80, causing connection refusal.
  2. Step 2: Understand port mapping importance

    Clients must use the service port, not the pod's internal port, to connect successfully.
  3. Final Answer:

    The service port is 8080, but curl uses port 80 -> Option A
  4. Quick Check:

    Port mismatch causes connection refused [OK]
Quick Trick: Match curl port to service port exactly [OK]
Common Mistakes:
  • Ignoring port mismatch between service and client
  • Assuming network is disabled without checking
  • Confusing service types with connectivity issues

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Kubernetes Quizzes