光辉岁月

docker kubectl 命令补全以及kubectl 安装

二进制安装kubectl

curl -LO https://storage.googleapis.com/kubernetes-release/release/$(curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt)/bin/linux/amd64/kubectl

chmod +x ./kubectl

mv ./kubectl /usr/local/bin/kubectl



# 家目录下配置 配置文件
cd
mkdir .kube
vim config



#在kubectl所在节点执行安装

yum install bash-completion -y


#kubectl支持命令自动补全,执行以下命令即可开启。

echo "source <(kubectl completion bash)" >> ~/.bashrc
.  ~/.bashrc


# docker 命令自动补全
yum -y install bash-completion
echo "source /usr/share/bash-completion/bash_completion" >> ~/.bashrc
.  ~/.bashrc

yum 安装kubectl

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

yum install -y kubectl 
posted @ 2020-06-22 14:44  taiman  阅读(784)  评论(0编辑  收藏  举报
哈哈哈