Skip to content

Commit

Permalink
fix k8s apt repository key and URL. (#46)
Browse files Browse the repository at this point in the history
* fix k8s apt repository key and URL.

Signed-off-by: Tomoya.Fujita <tomoya.fujita825@gmail.com>

* indent fixes.

Signed-off-by: Tomoya.Fujita <tomoya.fujita825@gmail.com>

---------

Signed-off-by: Tomoya.Fujita <tomoya.fujita825@gmail.com>
  • Loading branch information
fujitatomoya authored May 10, 2024
1 parent 7a04ce1 commit 24e6223
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions scripts/install_k8s_packages.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
set -e

### User Setting
KUBERNETES_VERSION=1.26.9-00
KUBERNETES_VERSION=v1.26

### Confirmation to install all dependent packages

Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 24e6223

Please sign in to comment.