linux下安装kubectl

时间:2021-06-17 14:30:01

查看所有版本:

https://github.com/kubernetes/kubernetes/blob/master/CHANGELOG.md

下载指定版本:

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

安装:

tar -zxvf kubernetes-client-linux-amd64.tar.gz
chmod +x ./kubernetes/client/bin/kubectl
sudo mv ./kubernetes/client/bin/kubectl /usr/local/bin/kubectl
sudo ln -s /usr/local/bin/kubectl /usr/bin/kubectl

配置链接集群(需先获取集群配置文件admin.conf)

mkdir -p $HOME/.kube
sudo mv admin.conf $HOME/.kube/config
sudo chown $(id -u):$(id -g) $HOME/.kube/config

测试:

kubectl version