Bird
0
0

Which command correctly forwards local port 5000 to port 80 on a pod named web-pod?

easy📝 Syntax Q3 of 15
Kubernetes - kubectl Essential Commands
Which command correctly forwards local port 5000 to port 80 on a pod named web-pod?
Akubectl port-forward pod/web-pod 80
Bkubectl port-forward pod/web-pod 80:5000
Ckubectl port-forward svc/web-pod 5000:80
Dkubectl port-forward pod/web-pod 5000:80
Step-by-Step Solution
Solution:
  1. Step 1: Identify resource type

    Pod name is web-pod, so use pod/web-pod.
  2. Step 2: Understand port mapping syntax

    Format is localPort:podPort, so 5000:80 forwards local 5000 to pod's 80.
  3. Final Answer:

    kubectl port-forward pod/web-pod 5000:80 -> Option D
  4. Quick Check:

    Local port first, then pod port. [OK]
Quick Trick: Use pod name and localPort:podPort syntax [OK]
Common Mistakes:
  • Reversing port order
  • Using service instead of pod when pod is specified
  • Omitting pod prefix

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Kubernetes Quizzes