Tag Archives: kubectl error

[Solved] kubectl error: sou-bash: _get_comp_words_by_ref: command not found

After deploying the k8s cluster architecture through kubeadm, using the kubectl tool, I want to use the tab key to associate the auto-completion and find that it does not work, and the error is as follows:

[root@k8s-master]# kubectl - bash: _get_comp_words_by_ref: command not found

Google it and found out that the bash-completion package needs to be installed first. The operation is as follows:

#Install bash-completion
 yum install bash -completion -y

#source takes effect
source /usr/share/bash-completion/ bash_completion

source <(kubectl completion bash)
You can use the tab key, the problem is solved!