Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to install specific version of Kubernetes?

Tags:

kubernetes

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.

like image 849
OlavT Avatar asked Apr 08 '18 19:04

OlavT


4 Answers

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 
like image 64
nickgryg Avatar answered Sep 16 '22 20:09

nickgryg


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 
like image 36
Mohammed Rafeeq Avatar answered Sep 19 '22 20:09

Mohammed Rafeeq


None of the answers get small tip about where get proper package version. So my solution for debian 10 (buster) how to install not latest (1.20) but 1.18 version of kubeadm

sudo apt-get update && sudo apt-get install -y apt-transport-https curl

curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo apt-key add -

cat <<EOF | sudo tee /etc/apt/sources.list.d/kubernetes.list
deb https://apt.kubernetes.io/ kubernetes-xenial main
EOF

apt update

There is the most important thing I got a problem :). Get available package versions

apt list -a kubeadm

From the output select which you want to install

# apt list -a kubeadm
Listing... Done
kubeadm/kubernetes-xenial 1.20.0-00 amd64 [upgradable from: 1.18.13-00]
kubeadm/kubernetes-xenial 1.19.5-00 amd64
kubeadm/kubernetes-xenial 1.19.4-00 amd64
kubeadm/kubernetes-xenial 1.19.3-00 amd64
kubeadm/kubernetes-xenial 1.19.2-00 amd64
kubeadm/kubernetes-xenial 1.19.1-00 amd64
kubeadm/kubernetes-xenial 1.19.0-00 amd64
kubeadm/kubernetes-xenial,now 1.18.13-00 amd64 [installed,upgradable to: 1.20.0-00]
kubeadm/kubernetes-xenial 1.18.12-00 amd64
kubeadm/kubernetes-xenial 1.18.10-00 amd64

For me it was latest version for 1.18: 1.18.13-00
And now simply specify this version for packages

apt install -y kubeadm=1.18.13-00 kubelet=1.18.13-00 kubectl=1.18.13-00

Hope it could save somebody time and nervous

like image 41
Panoptik Avatar answered Sep 19 '22 20:09

Panoptik


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

like image 30
Way Fun Avatar answered Sep 19 '22 20:09

Way Fun