Skip to content

Commit

Permalink
Update k8s apt repository in self-managed-k8s
Browse files Browse the repository at this point in the history
Signed-off-by: AbdelrahmanElawady <[email protected]>
  • Loading branch information
AbdelrahmanElawady authored and daemon1024 committed Mar 15, 2024
1 parent ac57611 commit 27d49be
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions contribution/self-managed-k8s/k8s/install_kubernetes.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,23 +6,22 @@
sudo apt-get update

# install apt-transport-https
sudo apt-get install -y apt-transport-https ca-certificates curl
sudo apt-get install -y apt-transport-https ca-certificates curl gpg

# get kubernetes latest version
k8sversion=$(curl -Ls https://dl.k8s.io/release/stable.txt | cut -d "." -f 1,2)

# add the key for kubernetes repo
sudo curl -fsSLo /usr/share/keyrings/kubernetes-archive-keyring.gpg https://packages.cloud.google.com/apt/doc/apt-key.gpg
curl -fsSL https://pkgs.k8s.io/core:/stable:/$k8sversion/deb/Release.key | sudo gpg --dearmor -o /etc/apt/keyrings/kubernetes-apt-keyring.gpg

# add sources.list.d
echo "deb [signed-by=/usr/share/keyrings/kubernetes-archive-keyring.gpg] https://apt.kubernetes.io/ kubernetes-xenial main" | sudo tee /etc/apt/sources.list.d/kubernetes.list
echo "deb [signed-by=/etc/apt/keyrings/kubernetes-apt-keyring.gpg] https://pkgs.k8s.io/core:/stable:/$k8sversion/deb/ /" | sudo tee /etc/apt/sources.list.d/kubernetes.list

# update repo
sudo apt-get update

# install kubernetes
if [ "$RUNTIME" == "containerd" ]; then
sudo apt-get install -y kubeadm kubelet kubectl
else # docker
sudo apt-get install -y kubeadm=1.23.0-00 kubelet=1.23.0-00 kubectl=1.23.0-00
fi
sudo apt-get install -y kubeadm kubelet kubectl

# exclude kubernetes packages from updates
sudo apt-mark hold kubeadm kubelet kubectl
Expand Down

0 comments on commit 27d49be

Please sign in to comment.