I Malla:
I ran these but getting
kubectl ge-bash: _get_comp_words_by_ref: command not found
source <(kubectl completion bash)
echo "source <(kubectl completion bash)" >> ~/.bashrc
How can we enable auto complete in server ?
I Malla:
I ran these but getting
kubectl ge-bash: _get_comp_words_by_ref: command not found
source <(kubectl completion bash)
echo "source <(kubectl completion bash)" >> ~/.bashrc
How can we enable auto complete in server ?
Mohamed Ayman:
You can install it with apt-get install bash-completion or yum install bash-completion, etc.
$ source /usr/share/bash-completion/bash_completion
$ echo ‘source <(kubectl completion bash)’ >>~/.bashrc
$ kubectl completion bash >/etc/bash_completion.d/kubectl
For more info please check this
I Malla:
Do we have to do all these in real exam? In Ann terminal or once only ?
Tej_Singh_Rana:
To make it persistent, put all configuration in a file. Like above.
unnivkn:
@I Malla In the exam you have to use only below 4-commands to enable auto completion. Also use namespace in the begining (eg: k -n my-namespace get po), else you feel auto completion not works. And make sure no syntax error in the commands
source <(kubectl completion bash) # setup autocomplete in bash into the current shell, bash-completion package should be installed first.
echo “source <(kubectl completion bash)” >> ~/.bashrc # add autocomplete permanently to your bash shell.
alias k=kubectl
complete -F __start_kubectl k
I Malla:
Thank you