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