Bird
0
0

Given two clusters with contexts 'clusterA' and 'clusterB', what is the output of the command:

medium📝 Command Output Q4 of 15
Kubernetes - Production Best Practices
Given two clusters with contexts 'clusterA' and 'clusterB', what is the output of the command:
kubectl config get-contexts | grep clusterB?
AShows only the context details for clusterB
BLists all contexts including clusterB
CReturns an error because grep cannot be used with kubectl
DShows no output if clusterB context does not exist
Step-by-Step Solution
Solution:
  1. Step 1: Understand kubectl config get-contexts output

    This command lists all contexts in the kubeconfig file.
  2. Step 2: Effect of piping to grep clusterB

    Using grep filters output to only lines containing 'clusterB', showing only that context's details.
  3. Final Answer:

    Shows only the context details for clusterB -> Option A
  4. Quick Check:

    grep filters contexts = clusterB only [OK]
Quick Trick: Pipe to grep to filter contexts by name [OK]
Common Mistakes:
  • Thinking grep causes an error with kubectl
  • Assuming all contexts are shown despite grep
  • Ignoring that output depends on clusterB existence

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Kubernetes Quizzes