Bird
0
0

Which of the following is the correct syntax to list all services in all namespaces using kubectl?

easy📝 Syntax Q12 of 15
Kubernetes - kubectl Essential Commands
Which of the following is the correct syntax to list all services in all namespaces using kubectl?
Akubectl get services -a
Bkubectl get services --all-namespaces
Ckubectl list services --all
Dkubectl show services --all-namespaces
Step-by-Step Solution
Solution:
  1. Step 1: Identify the correct command to list services

    kubectl get services is the correct base command to list services.
  2. Step 2: Use the correct flag for all namespaces

    The flag --all-namespaces lists resources across all namespaces; -a is not valid here.
  3. Final Answer:

    kubectl get services --all-namespaces -> Option B
  4. Quick Check:

    Use --all-namespaces to list across namespaces [OK]
Quick Trick: Use full flag --all-namespaces, not short or wrong ones [OK]
Common Mistakes:
  • Using incorrect short flag '-a' which is invalid
  • Using 'list' or 'show' instead of 'get'
  • Forgetting to specify namespaces flag for cluster-wide listing

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Kubernetes Quizzes