Bird
0
0

Given two pods named app-pod in namespaces dev and prod, what will kubectl get pods --all-namespaces show?

medium📝 Command Output Q4 of 15
Kubernetes - Namespaces
Given two pods named app-pod in namespaces dev and prod, what will kubectl get pods --all-namespaces show?
AOnly the pod in the default namespace
BOnly pods from the current namespace
CAn error because pods have the same name
DBoth pods listed with their respective namespaces
Step-by-Step Solution
Solution:
  1. Step 1: Understand the command behavior

    'kubectl get pods --all-namespaces' lists pods from all namespaces.
  2. Step 2: Recognize namespace isolation

    Pods with the same name can exist in different namespaces without conflict.
  3. Final Answer:

    Both pods listed with their respective namespaces -> Option D
  4. Quick Check:

    All namespaces pods listed = B [OK]
Quick Trick: Use --all-namespaces to see pods across all namespaces [OK]
Common Mistakes:
  • Thinking pods with same name cause errors
  • Assuming only default namespace pods show
  • Forgetting to use --all-namespaces flag

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Kubernetes Quizzes