K8s kubectl error:c-bash: _get_comp_words_by_ref: command not found

故障现象:

新搭了个测试环境,准备cka的考试

source <(kubectl completion bash)

运行kubectl tab时出现以下报错

[root@master bin]# kubectl c-bash: _get_comp_words_by_ref: command not found
loud-controller-man^C

解决方法:

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 
Logo

K8S/Kubernetes社区为您提供最前沿的新闻资讯和知识内容

更多推荐