1. 查看 kubectl 帮助信息
bash
[root@k8s231 /etc/kubernetes]# kubectl --help
Settings Commands:
label Update the labels on a resource
annotate Update the annotations on a resource
completion Output shell completion code for the specified shell (bash, zsh or fish)
#completion 这个是管理命令补全功能的
2. 再次查看帮助信息
bash
[root@k8s231 /etc/kubernetes]# kubectl completion --help
#linux 查看这里
#基于当前生效,临时性的
kubectl completion bash > ~/.kube/completion.bash.inc
# Kubectl shell completion
echo "source '$HOME/.kube/completion.bash.inc'" >> $HOME/.bash_profile
source $HOME/.bash_profile
# 根据提示执行相关命令 ,永久生效
yum --y install bash-completion
kubectl completion bash > ~/.kube/completion.bash.inc
echo "source '$HOME/.kube/completion.bash.inc'" >> $HOME/.bash_profile
source $HOME/.bash_profile