yum install -y bash-completion
source /usr/share/bash-completion/bash_completion
source <(kubectl completion bash)
以上只是零时起作用,每次登录终端都得起效需要:
source /usr/share/bash-completion/bash_completion
source <(kubectl completion bash)
加入到/root/.bashrc文件中。
即可以:
source <(kubectl completion bash)
echo "source <(kubectl completion bash)" >> ~/.bashrc
echo "source <(helm completion bash)" >> ~/.bashrc