centos

yum install -y bash-completion 
#启动加载
echo 'source <(kubectl completion bash)' >> ~/.bashrc
source ~/.bashrc

debian

apt install bash-completion  -y

测试效果

kubectl(双击 Tab 键)