Bird
0
0

You want to list all deployments in the namespace 'production' with their labels shown. Which command achieves this?

hard📝 Workflow Q15 of 15
Kubernetes - kubectl Essential Commands
You want to list all deployments in the namespace 'production' with their labels shown. Which command achieves this?
Akubectl list deployments -namespace production -labels
Bkubectl get deployment production --labels
Ckubectl get deployments -n production --show-labels
Dkubectl get deployments --namespace=production -o labels
Step-by-Step Solution
Solution:
  1. Step 1: Specify the resource and namespace correctly

    kubectl get deployments lists deployments; -n production sets the namespace.
  2. Step 2: Use the correct flag to show labels

    The flag --show-labels adds labels column to the output. Other options use incorrect flags or syntax.
  3. Final Answer:

    kubectl get deployments -n production --show-labels -> Option C
  4. Quick Check:

    Use -n for namespace and --show-labels to display labels [OK]
Quick Trick: Use -n for namespace and --show-labels to see labels [OK]
Common Mistakes:
  • Using singular 'deployment' instead of 'deployments'
  • Wrong flags like '--labels' or '-labels'
  • Using 'list' instead of 'get'

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Kubernetes Quizzes