开启 k8s 命令补全功能

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
相关推荐
LuiChun1 小时前
docker desktop更新到【4.45.0 】后,旧容器镜像都丢失了
docker·容器·dubbo
Sweety丶╮7941 小时前
【Ansible】实施 Ansible Playbook知识点
服务器·云原生·ansible
ZLRRLZ1 小时前
【Docker】Docker安装
运维·docker·容器
Dxy12393102163 小时前
Docker常用命令详解
docker·容器·eureka
清寒敲代码3 小时前
k8s核心技术-Helm
运维·容器·kubernetes
魏 无羡3 小时前
k8s 获取真实ip地址
tcp/ip·容器·kubernetes
人工智能训练师3 小时前
在Ubuntu中如何使用PM2来运行一个编译好的Vue项目
linux·运维·服务器·vue.js·ubuntu·容器
阿小木的愤怒4 小时前
详细解读Docker
docker·容器·容器化·虚拟化技术
wp90904 小时前
Docker命令大全
docker·云原生·eureka
傻傻虎虎4 小时前
【CentOS7】docker安装成功后测试,报Unable to find image ‘hello-world:latest‘ locally
docker·容器·eureka