Bird
0
0

After running kubectl config set-context --current --namespace=dev, what will kubectl get pods show by default?

medium📝 Command Output Q5 of 15
Kubernetes - Namespaces
After running kubectl config set-context --current --namespace=dev, what will kubectl get pods show by default?
APods in the 'default' namespace
BPods in the 'dev' namespace
CPods in all namespaces
DNo pods, command will error
Step-by-Step Solution
Solution:
  1. Step 1: Understand namespace context change effect

    Setting the current context namespace to 'dev' means kubectl commands run without explicit namespace target 'dev'.
  2. Step 2: Effect on 'kubectl get pods'

    Running 'kubectl get pods' will list pods only in the 'dev' namespace by default.
  3. Final Answer:

    Pods in the 'dev' namespace -> Option B
  4. Quick Check:

    Namespace context affects default pod listing namespace [OK]
Quick Trick: Set namespace context to list resources there by default [OK]
Common Mistakes:
  • Expecting pods from 'default' namespace
  • Thinking command lists pods from all namespaces
  • Assuming command errors without namespace flag

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Kubernetes Quizzes