开启 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
相关推荐
江畔何人初1 分钟前
pod的内部结构
linux·运维·云原生·容器·kubernetes
三块钱079430 分钟前
群晖docker部署Mattermost,对接openclaw
运维·docker·容器
周航宇JoeZhou2 小时前
JB2-7-HTML
java·前端·容器·html·h5·标签·表单
苦逼IT运维3 小时前
从 0 到 1 理解 Kubernetes:一次“破坏式”学习实践(一)
linux·学习·docker·容器·kubernetes
萧曵 丶3 小时前
Docker 面试题
运维·docker·容器
晨港飞燕3 小时前
容器,pod,节点概念
容器
腾讯云开发者3 小时前
言出法随 -- Chaterm如何通过ASR精准操作K8S
云原生·容器·kubernetes
为什么不问问神奇的海螺呢丶4 小时前
n9e categraf docker 监控配置
运维·docker·容器
青树寒鸦4 小时前
wsl的docker备份mongo和迁移
运维·mongodb·docker·容器
伟大的大威5 小时前
NVIDIA DGX Spark (ARM64/Blackwell) Kubernetes 集群 + GPU Operator 完整部署指南
大数据·spark·kubernetes