How to setup Kubectl autocomplete
In this article we'll setup Kubectl autocomplete. It save us time and add convinience.
Step 1. Install bash-completion
Now you need Logout and Login Again.
Step 2. Set Kubectl autocomplete
BASH
source <(kubectl completion bash)
# add autocomplete permanently to your bash
echo "source <(kubectl completion bash)" >> ~/.bashrc
Step 2. Set Kubectl Alias
You can also use a shorthand alias for kubectl
that also works with completion:
alias k=kubectl
complete -F __start_kubectl k
No comments