Bird
0
0

What will be the output of the command kubectl get namespaces after applying this YAML?

medium📝 Command Output Q13 of 15
Kubernetes - Namespaces
What will be the output of the command kubectl get namespaces after applying this YAML?
apiVersion: v1
kind: Namespace
metadata:
  name: test-env
AOnly default namespaces are shown, 'test-env' is missing
BShows an error: namespace 'test-env' already exists
CNo output, command hangs
DLists all namespaces including 'test-env'
Step-by-Step Solution
Solution:
  1. Step 1: Apply the namespace YAML

    Applying the YAML creates a new namespace named 'test-env' in the cluster.
  2. Step 2: Run 'kubectl get namespaces'

    This command lists all namespaces, including the newly created 'test-env'.
  3. Final Answer:

    Lists all namespaces including 'test-env' -> Option D
  4. Quick Check:

    kubectl get namespaces shows all namespaces [OK]
Quick Trick: New namespaces appear in 'kubectl get namespaces' output [OK]
Common Mistakes:
  • Expecting error if namespace exists (it won't if new)
  • Thinking command hangs
  • Assuming only default namespaces show

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Kubernetes Quizzes