开启 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
相关推荐
techzhi1 小时前
Apifox CLI + GitLab CI:接口自动化测试实施记录
java·ci/cd·kubernetes·gitlab·yapi·运维开发·fastapi
间彧1 小时前
Arthas Tunnel Server 在 Kubernetes 中的深度集成与实战指南
kubernetes
间彧1 小时前
在Docker Compose或Kubernetes中集成Arthas的最佳实践是什么?
kubernetes
❀͜͡傀儡师3 小时前
docker部署BentoPDF应用
运维·docker·容器
江湖有缘3 小时前
Docker快速部署NeonLink:打造你的私人书签管理平台
运维·docker·容器
岚天start4 小时前
【K8S分配率】Shell脚本计算Kubernetes集群CPU和内存总分配率
云原生·容器·kubernetes·分配率
密瓜智能4 小时前
HAMi Meetup-贝壳找房 回顾:vGPU 推理集群的实践经验
云原生·性能优化·开源·gpu算力·hami·密瓜智能
Connie14514 小时前
Kubernates证书续期操作步骤
kubernetes
rustfs5 小时前
使用 RustFS和 Arq,打造 PC 数据安全备份之道
分布式·docker·云原生·rust·开源
橙子❦5 小时前
官网下载docker--centos容器,后安装并启动容器
docker·容器·centos