Bird
0
0

Why does kubectl port-forward not expose the pod port to other machines on your network?

hard📝 Conceptual Q10 of 15
Kubernetes - kubectl Essential Commands
Why does kubectl port-forward not expose the pod port to other machines on your network?
ABecause pods do not have IP addresses accessible outside the cluster
BBecause Kubernetes blocks all external traffic by default
CBecause it binds only to localhost (127.0.0.1) by default for security
DBecause port-forward requires a LoadBalancer to expose ports externally
Step-by-Step Solution
Solution:
  1. Step 1: Understand port-forward binding behavior

    By default, port-forward binds to localhost (127.0.0.1), so only the local machine can access forwarded ports.
  2. Step 2: Eliminate other options

    Kubernetes does not block all external traffic; LoadBalancer is unrelated to port-forward; pods can have cluster IPs but port-forward is local only.
  3. Final Answer:

    Because it binds only to localhost (127.0.0.1) by default for security -> Option C
  4. Quick Check:

    Port-forward binds localhost only by default [OK]
Quick Trick: Port-forward binds localhost only for security [OK]
Common Mistakes:
  • Thinking port-forward exposes ports externally
  • Confusing with LoadBalancer services
  • Assuming pods lack IPs

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Kubernetes Quizzes