Question 35
Domain 1: Cluster Architecture, Installation & ConfigurationWhich command enables Bash completion for kubectl in the current shell session?
Correct answer: A
Explanation
`source <(kubectl completion bash)` runs the Bash completion script in the current shell, which is why it enables tab completion only for that session. The `source` command executes the output of `kubectl completion bash` in-place instead of starting a new shell.
Why each option is right or wrong
A. source <(kubectl completion bash)
`kubectl completion bash` emits the Bash completion function definitions to standard output, and the Bash built-in `source` (alias `.`) executes that output in the current shell rather than a subshell. Because it is loaded into the active session, tab completion becomes available immediately for that shell only; no file is written and no persistent configuration is changed.
B. kubectl autocomplete bash
C. enable kubectl completion
D. source /etc/bash_completion.d/kubectl