Özel dağıtımlarda dahili kullanım için Kubernetes’in community sürümüne kıyasla 17 ay geciktiğine dair bir rapor okuduğumu hatırlıyorum. Bu nedenle birçok şirkette Kubernetes’in eski bir sürümünü yüklemek rutin bir işlem haline geldi.
Ancak, Kubernetes’te yalnızca sürüm oluşturma sorunları değil, aynı zamanda kurulum aracı kubeadm’in de sürüm oluşturma gereksinimleri vardır. Bu nedenle belirli bir Kubernetes sürümünü yüklemek için belirli bir kubeadm sürümünü sistem üzerine yüklemeniz gerekecektir.
İşte Ubuntu Server işletim sistemi altında Kubernetes’in 1.24 sürümünün nasıl kurulacağına dair bir örnek komut çıktısı yer almaktadır.
apt-cache madison kubectl | grep 1.24 root@k8s-master01:~# apt-cache madison kubectl | grep 1.24 kubectl | 1.24.7-00 | https://apt.kubernetes.io kubernetes-xenial/main amd64 Packages kubectl | 1.24.6-00 | https://apt.kubernetes.io kubernetes-xenial/main amd64 Packages kubectl | 1.24.5-00 | https://apt.kubernetes.io kubernetes-xenial/main amd64 Packages kubectl | 1.24.4-00 | https://apt.kubernetes.io kubernetes-xenial/main amd64 Packages kubectl | 1.24.3-00 | https://apt.kubernetes.io kubernetes-xenial/main amd64 Packages kubectl | 1.24.2-00 | https://apt.kubernetes.io kubernetes-xenial/main amd64 Packages kubectl | 1.24.1-00 | https://apt.kubernetes.io kubernetes-xenial/main amd64 Packages kubectl | 1.24.0-00 | https://apt.kubernetes.io kubernetes-xenial/main amd64 PackagesBöylece sürüm numarası olarak yüklenecek maksimum sayıyı seçebiliriz.
apt install -y kubelet=1.24.7-00 kubeadm=1.24.7-00 kubectl=1.24.7-00Son olarak, belirtilen Kubernetes sürümünü yüklemek için kubeadm komutunu bu bilgilerden yola çıkarak aşağıdaki örnek komut ile başlayabilirsiniz.
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.24.7-00 kubectl=1.24.7-00 kubeadm=1.24.7-0 root@k8s-worker01:~# 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.24.7-00 kubectl=1.24.7-00 kubeadm=1.24.7-00 OK deb http://apt.kubernetes.io/ kubernetes-xenial main Hit:2 http://archive.ubuntu.com/ubuntu focal InRelease Hit:3 http://archive.ubuntu.com/ubuntu focal-updates InRelease Hit:4 http://archive.ubuntu.com/ubuntu focal-backports InRelease Hit:5 http://archive.ubuntu.com/ubuntu focal-security InRelease Get:1 https://packages.cloud.google.com/apt kubernetes-xenial InRelease [9,383 B] Get:6 https://packages.cloud.google.com/apt kubernetes-xenial/main amd64 Packages [60.6 kB] Fetched 70.0 kB in 1s (57.1 kB/s) Reading package lists… Reading package lists… Building dependency tree… Reading state information… The following additional packages will be installed: conntrack cri-tools ebtables kubernetes-cni socat Suggested packages: nftables The following NEW packages will be installed: conntrack cri-tools ebtables kubeadm kubectl kubelet kubernetes-cni socat 0 upgraded, 8 newly installed, 0 to remove and 0 not upgraded. Need to get 80.9 MB of archives. After this operation, 330 MB of additional disk space will be used. Get:1 http://archive.ubuntu.com/ubuntu focal/main amd64 conntrack amd64 1:1.4.5-2 [30.3 kB] Get:3 http://archive.ubuntu.com/ubuntu focal/main amd64 ebtables amd64 2.0.11-3build1 [80.3 kB] Get:5 http://archive.ubuntu.com/ubuntu focal/main amd64 socat amd64 1.7.3.3-2 [323 kB] Get:2 https://packages.cloud.google.com/apt kubernetes-xenial/main amd64 cri-tools amd64 1.25.0-00 [17.9 MB] Get:4 https://packages.cloud.google.com/apt kubernetes-xenial/main amd64 kubernetes-cni amd64 1.1.1-00 [25.0 MB] Get:6 https://packages.cloud.google.com/apt kubernetes-xenial/main amd64 kubelet amd64 1.24.7-00 [19.2 MB] Get:7 https://packages.cloud.google.com/apt kubernetes-xenial/main amd64 kubectl amd64 1.24.7-00 [9,326 kB] Get:8 https://packages.cloud.google.com/apt kubernetes-xenial/main amd64 kubeadm amd64 1.24.7-00 [9,009 kB] Fetched 80.9 MB in 13s (6,059 kB/s) Selecting previously unselected package conntrack. (Reading database … 72187 files and directories currently installed.) Preparing to unpack …/0-conntrack_1%3a1.4.5-2_amd64.deb … Unpacking conntrack (1:1.4.5-2) … Selecting previously unselected package cri-tools. Preparing to unpack …/1-cri-tools_1.25.0-00_amd64.deb … Unpacking cri-tools (1.25.0-00) … Selecting previously unselected package ebtables. Preparing to unpack …/2-ebtables_2.0.11-3build1_amd64.deb … Unpacking ebtables (2.0.11-3build1) … Selecting previously unselected package kubernetes-cni. Preparing to unpack …/3-kubernetes-cni_1.1.1-00_amd64.deb … Unpacking kubernetes-cni (1.1.1-00) … Selecting previously unselected package socat. Preparing to unpack …/4-socat_1.7.3.3-2_amd64.deb … Unpacking socat (1.7.3.3-2) … Selecting previously unselected package kubelet. Preparing to unpack …/5-kubelet_1.24.7-00_amd64.deb … Unpacking kubelet (1.24.7-00) … Selecting previously unselected package kubectl. Preparing to unpack …/6-kubectl_1.24.7-00_amd64.deb … Unpacking kubectl (1.24.7-00) … Selecting previously unselected package kubeadm. Preparing to unpack …/7-kubeadm_1.24.7-00_amd64.deb … Unpacking kubeadm (1.24.7-00) … Setting up conntrack (1:1.4.5-2) … Setting up kubectl (1.24.7-00) … Setting up ebtables (2.0.11-3build1) … Setting up socat (1.7.3.3-2) … Setting up cri-tools (1.25.0-00) … Setting up kubernetes-cni (1.1.1-00) … Setting up kubelet (1.24.7-00) … Created symlink /etc/systemd/system/multi-user.target.wants/kubelet.service → /lib/systemd/system/kubelet.service. Setting up kubeadm (1.24.7-00) … Processing triggers for man-db (2.9.1-1) … root@k8s-worker01:~#