How to install specific version of Kubernetes?

2020-02-23 08:47发布

I install the latest version of Kubernetes with the following command on Raspberry PI 3 running Raspbian Stretch.

$ curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo apt-key add - && \
  echo "deb http://apt.kubernetes.io/ kubernetes-xenial main" | sudo tee /etc/apt/sources.list.d/kubernetes.list && \
  sudo apt-get update -q && \
  sudo apt-get install -qy kubeadm

Currently this will install v1.10.0.

How can I install a specific version of Kubernetes? Let's say v1.9.6.

标签: kubernetes
3条回答
乱世女痞
2楼-- · 2020-02-23 08:58

on Mac to install v1.8.5 of kubernetes follow the below steps

Get the kubectl binary.

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

Make the kubectl binary executable.

chmod +x ./kubectl

Move the kubectl executable to /usr/local/bin.

sudo mv ./kubectl /usr/local/bin/kubectl
查看更多
对你真心纯属浪费
3楼-- · 2020-02-23 09:06

To install specific version of the package it is enough to define it during the apt-get install command:

apt-get install -qy kubeadm=<version>

But in the current case kubectl and kubelet packages are installed by dependencies when we install kubeadm, so all these three packages should be installed with a specific version:

$ curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo apt-key add - && \
  echo "deb http://apt.kubernetes.io/ kubernetes-xenial main" | sudo tee /etc/apt/sources.list.d/kubernetes.list && \
  sudo apt-get update -q && \
  sudo apt-get install -qy kubelet=<version> kubectl=<version> kubeadm=<version>

where available <version> is:

curl -s https://packages.cloud.google.com/apt/dists/kubernetes-xenial/main/binary-amd64/Packages | grep Version | awk '{print $2}'

For your particular case it is:

$ curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo apt-key add - && \
  echo "deb http://apt.kubernetes.io/ kubernetes-xenial main" | sudo tee /etc/apt/sources.list.d/kubernetes.list && \
  sudo apt-get update -q && \
  sudo apt-get install -qy kubelet=1.9.6-00 kubectl=1.9.6-00 kubeadm=1.9.6-00
查看更多
走好不送
4楼-- · 2020-02-23 09:11

You can use below command to install Particular version of Kubernetes In Centos/Redhat Machines and same format can use other distributions as well .

yum install -y kubelet-1.11.1 kubeadm-1.11.1 kubectl-1.11.1 kubernetes-cni-0.6.0-0.x86_64

查看更多
登录 后发表回答