Kubectl Bash Autocomplete

Posted by

I was speaking to someone the other day who is new to Kubernetes. While playing around with Kubectl commands they mentioned that there was no way to tab to autocomplete. This conversation inspired this quick and easy how to K8 article.

From your terminal execute the following commands:
sudo apt-get install bash-completion
echo “source <(kubectl completion bash)” >> ~/.bashrc
source ~/.bashrc

You should now be able to tab to autocomplete your commands. As always I hope y’all found this to be helpful.

Leave a Reply