From 8e91a950fbfac8777b24f8fc577f7159bce65ee4 Mon Sep 17 00:00:00 2001 From: Pedro Escaleira Date: Mon, 4 Mar 2024 17:07:11 +0000 Subject: [PATCH] Fix Bug 2338: updated kubernetes apt repo from apt.kubernetes.io to pkgs.k8s.io Change-Id: Ifee6e0f52396d3ec459b0e8b0ffec0698feff608 Signed-off-by: escaleira --- installers/install_kubeadm_cluster.sh | 30 +++++++++++++++------------ 1 file changed, 17 insertions(+), 13 deletions(-) diff --git a/installers/install_kubeadm_cluster.sh b/installers/install_kubeadm_cluster.sh index 70f6d9da..babf17ca 100755 --- a/installers/install_kubeadm_cluster.sh +++ b/installers/install_kubeadm_cluster.sh @@ -15,24 +15,28 @@ set +eux -#installs kubernetes packages +K8S_VERSION=1.24 +K8S_PACKAGE_VERSION="$K8S_VERSION".17-1.1 +HELM_VERSION="v3.10.3" + +# installs kubernetes packages function install_kube() { [ -z "${DEBUG_INSTALL}" ] || DEBUG beginning of function - K8S_VERSION=1.23.3-00 # Kubernetes releases can be found here: https://kubernetes.io/releases/ # To check other available versions, run the following command # curl -s https://packages.cloud.google.com/apt/dists/kubernetes-xenial/main/binary-amd64/Packages | grep Version | awk '{print $2}' - sudo apt-get update && sudo apt-get install -y apt-transport-https - sudo apt-get update && sudo apt-get install -y apt-transport-https - curl -fsSL https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo apt-key add - - sudo add-apt-repository "deb https://apt.kubernetes.io/ kubernetes-xenial main" - sudo apt-get update + sudo mkdir /etc/apt/keyrings + sudo apt-get -y update && sudo apt-get install -y apt-transport-https ca-certificates curl + curl -fsSL https://pkgs.k8s.io/core:/stable:/v"$K8S_VERSION"/deb/Release.key | sudo gpg --dearmor -o /etc/apt/keyrings/kubernetes-apt-keyring.gpg + echo 'deb [signed-by=/etc/apt/keyrings/kubernetes-apt-keyring.gpg] https://pkgs.k8s.io/core:/stable:/v'$K8S_VERSION'/deb/ /' | sudo tee /etc/apt/sources.list.d/kubernetes.list + sudo apt-get -y update echo "Installing Kubernetes Packages ..." - sudo apt-get install -y kubelet=${K8S_VERSION} kubeadm=${K8S_VERSION} kubectl=${K8S_VERSION} - cat << EOF | sudo tee -a /etc/default/kubelet - KUBELET_EXTRA_ARGS="--cgroup-driver=cgroupfs" -EOF + sudo apt-get install -y kubelet=${K8S_PACKAGE_VERSION} kubeadm=${K8S_PACKAGE_VERSION} kubectl=${K8S_PACKAGE_VERSION} sudo apt-mark hold kubelet kubeadm kubectl + + sudo rm /etc/containerd/config.toml + sudo systemctl restart containerd + [ -z "${DEBUG_INSTALL}" ] || DEBUG end of function } @@ -71,8 +75,9 @@ function deploy_cni_provider() { #taints K8s master node function taint_master_node() { [ -z "${DEBUG_INSTALL}" ] || DEBUG beginning of function - K8S_MASTER=$(kubectl get nodes | awk '$3~/master/'| awk '{print $1}') + K8S_MASTER=$(kubectl get nodes | awk '$3~/control-plane/'| awk '{print $1}') kubectl taint node $K8S_MASTER node-role.kubernetes.io/master:NoSchedule- + kubectl taint node $K8S_MASTER node-role.kubernetes.io/control-plane:NoSchedule- sleep 5 [ -z "${DEBUG_INSTALL}" ] || DEBUG end of function } @@ -81,7 +86,6 @@ function taint_master_node() { #Helm releases can be found here: https://github.com/helm/helm/releases function install_helm() { [ -z "${DEBUG_INSTALL}" ] || DEBUG beginning of function - HELM_VERSION="v3.7.2" if ! [[ "$(helm version --short 2>/dev/null)" =~ ^v3.* ]]; then # Helm is not installed. Install helm echo "Helm3 is not installed, installing ..." -- 2.25.1