- When working with the Kubectl CLI often, it is much more efficient to be able to autocomplete long commands and resource names.
- Platform9 Managed Kubernetes - All Versions
- MacOS X - v10.13.x
- Install the Homebrew binary.
$ /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
- Install the bash-completion package.
$ brew install bash-completion
- If you do not have a dedicated terminal and need to enable autocompletion on the fly, run the following command.
$ source <(kubectl completion bash)Otherwise, append the following command to your .bashrc file to enable autocomplete persistently.
$ echo "source <(kubectl completion bash)" >> ~/.bashrc
See Kubernetes Reference: Kubectl Cheat Sheet for more handy commands and configurations.