Bird
0
0

Given two pods named pod-a in namespaces dev and prod, what happens when you run kubectl get pods -n dev?

medium📝 Command Output Q13 of 15
Kubernetes - Namespaces
Given two pods named pod-a in namespaces dev and prod, what happens when you run kubectl get pods -n dev?
AIt shows an error because pod names must be unique cluster-wide
BIt lists only the pod named pod-a in the dev namespace
CIt lists only pods in the prod namespace
DIt lists pods from both dev and prod namespaces
Step-by-Step Solution
Solution:
  1. Step 1: Understand namespace scoping of pods

    Pods with the same name can exist in different namespaces without conflict.
  2. Step 2: Analyze the command effect

    The command kubectl get pods -n dev lists pods only in the 'dev' namespace.
  3. Final Answer:

    It lists only the pod named pod-a in the dev namespace -> Option B
  4. Quick Check:

    Namespace limits pod listing [OK]
Quick Trick: Pods with same name can exist in different namespaces [OK]
Common Mistakes:
  • Assuming pod names must be unique across cluster
  • Expecting pods from all namespaces without -n flag
  • Thinking the command lists prod namespace pods

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Kubernetes Quizzes