Kubernetes kubectl 命令自动补全

linux 命令补全

# centos 
yum install -y bash-completion
# Ubuntu
 apt install bash-completion
 # 生效命令补全
 source /usr/share/bash-completion/bash_completion
 # mac
 $ brew install bash-completion
  # 生效命令补全
 $ source $(brew --prefix)/etc/bash_completion
 # 可以测试docker 等其它很多命令
 docker  tab 建
[root@node02 ~]# docker
attach     config     create     exec       history    import     kill       logout     node       port       push       rm         save       service    stats      system     trust      version
build      container  diff       export     image      info       load       logs       pause      ps         rename     rmi        search     stack      stop       tag        unpause    volume
commit     cp         events     help       images     inspect    login      network    plugin     pull       restart    run        secret     start      swarm      top        update     wait

kubectl 命令补全

# linux
source <(kubectl completion bash)
echo "source <(kubectl completion bash)" >> ~/.bashrc
#或者
echo "source <(kubectl completion bash)" >> /etc/profile

# mac 
source <(kubectl completion bash)
# 测试
[root@node02 ~]# kubectl tab键
annotate       apply          autoscale      completion     cordon         delete         drain          explain        kustomize      options        port-forward   rollout        set            uncordon
api-resources  attach         certificate    config         cp             describe       edit           expose         label          patch          proxy          run            taint          version
api-versions   auth           cluster-info   convert        create         diff           exec           get            logs           plugin         replace        scale          top            wait

相关文章

今天小编给大家分享一下excel图案样式如何设置的相关知识点,...
这篇文章主要讲解了“win10设置过的壁纸如何删除”,文中的讲...
这篇“Xmanager怎么显示远程linux程序的图像”文章的知识点大...
今天小编给大家分享一下xmanager怎么连接linux的相关知识点,...
这篇“如何重置Linux云服务器的远程密码”文章的知识点大部分...
本篇内容介绍了“Linux云服务器手动配置DNS的方法是什么”的...