Bird
0
0

Assuming two pods pod-x and pod-y are in the same namespace, and pod-y runs a service on port 5000, what will be the result of running this command inside pod-x?

medium📝 Command Output Q4 of 15
Kubernetes - Networking

Assuming two pods pod-x and pod-y are in the same namespace, and pod-y runs a service on port 5000, what will be the result of running this command inside pod-x?

curl http://pod-y:5000

AThe command will connect but only if pod-y's IP is used instead of its name
BThe command will fail because pod names cannot be used for communication
CThe command will successfully connect to pod-y's service on port 5000
DThe command will fail because pods in the same namespace cannot communicate
Step-by-Step Solution
Solution:
  1. Step 1: Check namespace and DNS resolution

    Pods in the same namespace can resolve each other by pod name via cluster DNS.
  2. Step 2: Verify port and service availability

    Since pod-y runs a service on port 5000, curl to pod-y:5000 should succeed.
  3. Final Answer:

    The command will successfully connect to pod-y's service on port 5000 -> Option C
  4. Quick Check:

    Pod names resolve within the same namespace [OK]
Quick Trick: Pods in same namespace resolve each other by name [OK]
Common Mistakes:
  • Thinking pod names cannot be used for communication
  • Assuming IPs must be used instead of pod names
  • Believing pods in the same namespace cannot communicate

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Kubernetes Quizzes