kubernetes kubectl autocomplete operation command in the shell

Set on linux


yum install bash-completion
source /usr/share/bash-completion/bash_completion
echo ‘source <(kubectl completion bash)’ >>~/.bashrc
kubectl completion bash >/etc/bash_completion.d/kubectl
bash

Set on -bash mas


brew install bash-completion@2
export BASH_COMPLETION_COMPAT_DIR=/usr/local/etc/bash_completion.d
[[ -r /usr/local/etc/profile.d/bash_completion.sh ]] && . /usr/local/etc/profile.d/bash_completion.sh
echo ‘source <(kubectl completion bash)’ >>~/.bashrc
kubectl completion bash >/usr/local/etc/bash_completion.d/kubectl
参考
kubectl Enabling shell autocompletion

Released six original articles · won praise 0 · Views 1062

Guess you like

Origin blog.csdn.net/weixin_43394724/article/details/104176014