Install Kubernetes Kubectl Shell Autocomplete

In this short blog post, I will show you how to install the Kubernetes kubectl autocomplete command-line.

Using autocomplete can shorten the time it takes to type kubectl commands and remove the guesswork out of the picture.

Install

To install autocomplete on a macOS run the following command.

brew install bash-completion

To install autocomplete on Centos run the following command.

yum install bash-completion

To install autocomplete on Ubuntu Linux use:

apt-get install bash-completion

Enable Autocomplete

To enable kubectl autocomplete type the following commands in your shell.

source <(kubectl completion bash)
echo "source <(kubectl completion bash)" >> ~/.bashrc

Processing…
Success! You're on the list.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.