安装bash-completion(如果已经安装忽略即可):
sudo apt install bash-completion
测试一下:
source /usr/share/bash-completion/bash_completion
source <(kubectl completion bash)
测试没问题后,对 /root/.bashrc 加2行代码 ,方便以后每次登录自动生效:
source /usr/share/bash-completion/bash_completion
source <(kubectl completion bash)