Bash completion

The kubectl completion script for Bash can be generated with the command kubectl completion bash. Sourcing the completion script in your shell enables kubectl

How to enable Bash Completion in Linux Machine

Install Bash Completion using below command (on ubuntu machine)

apt-get update
apt-get install bash-completion

Run the below command to enable autocomplete

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