Bird
0
0

Which of the following is the correct syntax to add a new cluster context named 'clusterB' using kubectl?

easy📝 Syntax Q3 of 15
Kubernetes - Production Best Practices
Which of the following is the correct syntax to add a new cluster context named 'clusterB' using kubectl?
Akubectl create context clusterB --cluster=clusterB --user=userB
Bkubectl add context clusterB --cluster=clusterB --user=userB
Ckubectl config add-context clusterB --cluster=clusterB --user=userB
Dkubectl config set-context clusterB --cluster=clusterB --user=userB
Step-by-Step Solution
Solution:
  1. Step 1: Recall kubectl syntax for adding context

    The correct command is 'kubectl config set-context' to add or modify a context.
  2. Step 2: Verify options

    Options A, B, and D use invalid kubectl commands; only kubectl config set-context clusterB --cluster=clusterB --user=userB uses the correct syntax.
  3. Final Answer:

    kubectl config set-context clusterB --cluster=clusterB --user=userB -> Option D
  4. Quick Check:

    Correct context add syntax = set-context [OK]
Quick Trick: Use 'kubectl config set-context' to add or change contexts [OK]
Common Mistakes:
  • Using 'add-context' which is not a kubectl command
  • Confusing 'create' with 'set-context'
  • Omitting 'config' in the command

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Kubernetes Quizzes