1、安装bash-completion
[root@master ~]# yum install bash-completion
2、临时设置
[root@master ~]# source /usr/share/bash-completion/bash_completion
[root@master ~]# source <(kubectl completion bash)
3、永久生效
将2的语句加到root/.bashrc文件中
[root@master ~]# vim /root/.bashrc
source /usr/share/bash-completion/bash_completion
source <(kubectl completion bash)
4、完成