kubectl 安装和命令自动补全

kubectl 安装

centos

cat <<EOF > /etc/yum.repos.d/kubernetes.repo
[kubernetes]
name=Kubernetes
baseurl=https://packages.cloud.google.com/yum/repos/kubernetes-el7-x86_64
enabled=1
gpgcheck=1
repo_gpgcheck=1
gpgkey=https://packages.cloud.google.com/yum/doc/yum-key.gpg https://packages.cloud.google.com/yum/doc/rpm-package-key.gpg
EOF
yum install -y kubectl

ubuntu

sudo apt-get update && sudo apt-get install -y apt-transport-https
curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo apt-key add -
echo "deb https://apt.kubernetes.io/ kubernetes-xenial main" | sudo tee -a /etc/apt/sources.list.d/kubernetes.list
sudo apt-get update
sudo apt-get install -y kubectl

命令补全

在linux上

# yum install -y bash-completion
# source /usr/share/bash-completion/bash_completion
# source <(kubectl completion bash)

测试下,没问题后,我们对 /root/.bashrc 加2行代码 ,方便以后每次登录自动生效:

source /usr/share/bash-completion/bash_completion
source <(kubectl completion bash)

在mac上

$ brew install bash-completion
$ source $(brew --prefix)/etc/bash_completion
$ source <(kubectl completion bash)

kubectl 命令自动补全的更多相关文章

  1. kubernetes系列(小知识):kubectl命令自动补全

    kubectl命令自动补全 linux系统 yum install -y bash-completion source /usr/share/bash-completion/completions/d ...

  2. kubectl命令自动补全

    kubectl这个命令行工具非常重要,与之相关的命令也很多,我们也记不住那么多的命令,而且也会经常写错,所以命令自动补全是非常有必要的,kubectl命令行工具本身就支持complication,只需 ...

  3. kubernetes kubectl 命令自动补全

    yum install -y bash-completion source /usr/share/bash-completion/bash_completion source <(kubectl ...

  4. 命令自动补全模块rlcomplete

    rlcomplete定义了针对readline模块的命令自动补全函数.         当在unix平台下导入这个模块之后(前提是readline模块可用),一个Complete的实例会自动生成,并且 ...

  5. Mac 终端实现快速定位命令 自动补全目录

    基于macOS oh-my-zsh 切换终端主题 incr.zsh 实现快速定位命令 自动补全目录 效果预览 步骤 1.安装 oh-my-zsh sh -c "$(curl -fsSL ht ...

  6. Docker 命令自动补全?要的

    前言 不知道这个小伙伴有多久没用过 Docker 了, 突然对我说 Docker 命令怎么发生变化了 docker run ... #变成了 docker container run ... 他说,本 ...

  7. Mac系统实现git命令自动补全

    当我第一次使用mac电脑的时候,由于我是从事软件开发的程序员,所以必须经常要使用到git,然而发现在mac系统下,git不能实现命令的自动补全,然后网上查找资料,找到了解决办法,终于可以实现了git命 ...

  8. Mac终端命令自动补全

    在这里我们首先说一下mac终端执行命令的时候,不会像在windows系统中安装的linux一样支持自动补全,需要自己去调试 步骤如下: (1)打开终端输入nano .inputrc(这里一定要注意na ...

  9. git 命令自动补全

    下载 Git 的源代码 使用如下命令即可下载: git clone https://github.com/git/git 复制 git-completion.bash 源代码下有个 contrib/c ...

随机推荐

  1. Win10访问共享文件夹如何取消用户名密码

    win10中,开启guest(来宾)账户的步骤是: 右击win10左下角Windows的图标->计算机管理->计算机管理(本地)->系统工具->本地用户和组->用户-&g ...

  2. 转 mysql 备份导致 waiting for global read lock

    ######转 https://blog.csdn.net/weixin_34038652/article/details/92129498 近业务高峰期间经常会有开发跳起来说应用连接数据库超时了! ...

  3. LeetCode_414. Third Maximum Number

    414. Third Maximum Number Easy Given a non-empty array of integers, return the third maximum number ...

  4. RedisTemplate 获取redis中以某些字符串为前缀的KEY列表

    // *号 必须要加,否则无法模糊查询 String prefix = "ofc-pincode-"+ pincode + "-*"; // 获取所有的key ...

  5. [LeetCode] 505. The Maze II 迷宫 II

    There is a ball in a maze with empty spaces and walls. The ball can go through empty spaces by rolli ...

  6. 多个进程间通信之Queue

    多个进程间通信之Queue 实现数据传递 #!coding:utf-8 from multiprocessing import Process, Queue import os,time,random ...

  7. python:使用多线程同时执行多个函数

    使用多线程同时执行多个函数 import time import os import threading def open_calc(): with open('test.txt', 'r') as ...

  8. Kubernetes 基于 RBAC 的授权(十六)

    目录 一.RBAC介绍 1.1.角色和集群角色 1.2.RoleBinding 和 ClusterRoleBinding 1.3.资源 1.4.主体 二.命令行工具 2.1.kubectl creat ...

  9. pychram 中 Terminal 中 git log 中文乱码解决办法

    添加环境变量 set LESSCHARSET=utf-8 执行以下命令 git config --global core.quotepath false 不成功执行以下命令 git config -- ...

  10. 19 IO流(十六)——Commons工具包,FileUtils(一)

    Commons包的API:自己查吧懒得传云 Commons包的导入方法 Commons是一个java的IO开源工具,导入方法: 从apache.org下载commons包 解压 copy其中的comm ...