From 24e622338aae99d908854c1218f36a6982e07339 Mon Sep 17 00:00:00 2001 From: Tomoya Fujita Date: Thu, 9 May 2024 21:40:41 -0700 Subject: [PATCH] fix k8s apt repository key and URL. (#46) * fix k8s apt repository key and URL. Signed-off-by: Tomoya.Fujita * indent fixes. Signed-off-by: Tomoya.Fujita --------- Signed-off-by: Tomoya.Fujita --- scripts/install_k8s_packages.sh | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/scripts/install_k8s_packages.sh b/scripts/install_k8s_packages.sh index fc683cc..3c7ad88 100755 --- a/scripts/install_k8s_packages.sh +++ b/scripts/install_k8s_packages.sh @@ -5,7 +5,7 @@ set -e ### User Setting -KUBERNETES_VERSION=1.26.9-00 +KUBERNETES_VERSION=v1.26 ### Confirmation to install all dependent packages @@ -62,10 +62,13 @@ function install_container_runtime () { function install_kubernetes () { trap exit_trap ERR - apt install -y apt-transport-https curl - curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg | apt-key add - apt-add-repository -y "deb http://apt.kubernetes.io/ kubernetes-xenial main" - apt install -y --allow-downgrades kubeadm=$KUBERNETES_VERSION kubelet=$KUBERNETES_VERSION kubectl=$KUBERNETES_VERSION + apt remove -y --allow-change-held-packages kubelet kubectl kubeadm + apt install -y apt-transport-https ca-certificates curl + curl -fsSL https://pkgs.k8s.io/core:/stable:/$KUBERNETES_VERSION/deb/Release.key | gpg --yes --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:/$KUBERNETES_VERSION/deb/ /" | tee /etc/apt/sources.list.d/kubernetes.list + apt update -y + apt install -y kubelet kubeadm kubectl + apt-mark hold kubelet kubeadm kubectl kubeadm version ### kubectl version will try to access server that leads to error to exit this script kubectl version --client