开启 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
相关推荐
落日漫游11 分钟前
K8s Service核心功能:稳定访问与负载均衡
docker·kubernetes·负载均衡
云计算老刘27 分钟前
1. Cockpit 管理服务器;2. Linux 软件包管理
linux·运维·服务器·云原生·云计算
海域云SeaArea_35 分钟前
ubuntu22.01安装NVIDIA-Docker
运维·docker·容器
oneslide5 小时前
Kubernetes V1.24+ & Docker运行时 grafana容器指标显示异常
docker·kubernetes·grafana
终端行者5 小时前
k8s各种场景下排错思路以及命令 k8s常见问题故障处理思路
云原生·容器·kubernetes
RisunJan13 小时前
docker一键部署项目
运维·docker·容器
你的人类朋友13 小时前
😎 Node.js 应用多阶段构建 Dockerfile 详解
后端·docker·容器
victory043114 小时前
K8S NFS 静态配置和动态配置 StorageClass
云原生·容器·kubernetes
运维 小白14 小时前
k8s 部署NFS和动态供应器
云原生·容器·kubernetes
hweiyu0015 小时前
Docker(K8S)容器架构教程(视频教程)
docker·架构·kubernetes