k8s kubectl命令自动补全

临时生效

1.安装bash-completion
[root@master bin]# yum install bash-completion -y

2.执行bash_completion
[root@master bin]# source /usr/share/bash-completion/bash_completion

3.重新加载kubectl completion
[root@master bin]# source <(kubectl completion bash)

4.就能用tab补全命令了
[root@master bin]# kubectl create clusterrolebinding

永久生效

再执行以下命令

echo "source <(kubectl completion bash)" >> ~/.bashrc
posted @ 2021-12-23 16:39  王诚意  阅读(109)  评论(0编辑  收藏  举报