I remember reading a report the other day that Kubernetes for internal use in private deployments was delayed by 17 months compared to the community version. So, in many companies, installing an older version of Kubernetes may be a routine operation.
However, not only does Kubernetes have versioning issues, but its installation tool, kubeadm, also has versioning requirements, so in order to install a specific version of Kubernetes, you have to install a specific version of kubeadm.
Here’s an example of how to install a 1.16 version of Kubernetes under Ubuntu.
You can use the apt-cache
command to see what Kubernetes versions are supported.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
|
# apt-cache madison kubectl | grep 1.16
kubectl | 1.16.15-00 | https://apt.kubernetes.io kubernetes-xenial/main amd64 Packages
kubectl | 1.16.14-00 | https://apt.kubernetes.io kubernetes-xenial/main amd64 Packages
kubectl | 1.16.13-00 | https://apt.kubernetes.io kubernetes-xenial/main amd64 Packages
kubectl | 1.16.12-00 | https://apt.kubernetes.io kubernetes-xenial/main amd64 Packages
kubectl | 1.16.11-01 | https://apt.kubernetes.io kubernetes-xenial/main amd64 Packages
kubectl | 1.16.11-00 | https://apt.kubernetes.io kubernetes-xenial/main amd64 Packages
kubectl | 1.16.10-00 | https://apt.kubernetes.io kubernetes-xenial/main amd64 Packages
kubectl | 1.16.9-00 | https://apt.kubernetes.io kubernetes-xenial/main amd64 Packages
kubectl | 1.16.8-00 | https://apt.kubernetes.io kubernetes-xenial/main amd64 Packages
kubectl | 1.16.7-00 | https://apt.kubernetes.io kubernetes-xenial/main amd64 Packages
kubectl | 1.16.6-00 | https://apt.kubernetes.io kubernetes-xenial/main amd64 Packages
kubectl | 1.16.5-00 | https://apt.kubernetes.io kubernetes-xenial/main amd64 Packages
kubectl | 1.16.4-00 | https://apt.kubernetes.io kubernetes-xenial/main amd64 Packages
kubectl | 1.16.3-00 | https://apt.kubernetes.io kubernetes-xenial/main amd64 Packages
kubectl | 1.16.2-00 | https://apt.kubernetes.io kubernetes-xenial/main amd64 Packages
kubectl | 1.16.1-00 | https://apt.kubernetes.io kubernetes-xenial/main amd64 Packages
kubectl | 1.16.0-00 | https://apt.kubernetes.io kubernetes-xenial/main amd64 Packages
|
So we can choose a maximum number to install as the version number.
1
2
3
4
5
6
7
|
# apt install -y kubelet=1.16.15-00 kubeadm=1.16.15-00 kubectl=1.16.15-00
... ...
Setting up kubelet (1.16.15-00) ...
Setting up kubectl (1.16.15-00) ...
Setting up kubeadm (1.16.15-00) ...
|
Finally, use kubeadm to install the specified version of Kubernetes.
1
2
3
4
|
# kubeadm init --cri-socket /run/containerd/containerd.sock \
--pod-network-cidr=10.244.0.0/16 \
--apiserver-advertise-address 192.168.2.147 \
--kubernetes-version v1.16.0
|