Linux 安装kubectl

基础理解转自:https://mp.weixin.qq.com/s/4pZNmXwEij6owbXFMAGpew

1、下载最新版本:

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

2.要下载指定版本,可以使用以下命令:

curl -LO https://storage.googleapis.com/kubernetes-release/release/v1.16.1/bin/linux/amd64/kubectl

curl -LO https://dl.k8s.io/v1.16.1/kubernetes-client-linux-amd64.tar.gz

3.安装

tar-zxvf kubernetes-client-linux-amd64.tar.gz

chmod+x ./kubernetes/client/bin/kubectl

mv ./kubernetes/client/bin/kubectl  /usr/local/bin/kubectl

ln-s /usr/local/bin/kubectl /usr/bin/kubectl

4.配置链接集群(需先获取集群配置文件admin.conf,这个文件在/etc/kubernetes/)

mkdir -p $HOME/.kube

sudo mv admin.conf $HOME/.kube/config

sudo chown $(id -u):$(id -g) $HOME/.kube/config

5.测试

kubectl version

你可能感兴趣的:(Linux 安装kubectl)