#!/bin/sh # Source: http://kubernetes.io/docs/getting-started-guides/kubeadm set -e source /etc/lsb-release if [ "$DISTRIB_RELEASE" != "20.04" ]; then echo "################################# " echo "############ WARNING ############ " echo "################################# " echo echo "This script only works on Ubuntu 20.04!" echo "You're using: ${DISTRIB_DESCRIPTION}" echo "Better ABORT with Ctrl+C. Or press any key to continue the install" read fi KUBE_VERSION=1.29.2 # get platform PLATFORM=`uname -p` if [ "${PLATFORM}" == "aarch64" ]; then PLATFORM="arm64" elif [ "${PLATFORM}" == "x86_64" ]; then PLATFORM="amd64" else echo "${PLATFORM} has to be either amd64 or arm64/aarch64. Check containerd supported binaries page" echo "https://github.com/containerd/containerd/blob/main/docs/getting-started.md#option-1-from-the-official-binaries" exit 1 fi ### setup terminal apt-get --allow-unauthenticated update apt-get --allow-unauthenticated install -y bash-completion binutils echo 'colorscheme ron' >> ~/.vimrc echo 'set tabstop=2' >> ~/.vimrc echo 'set shiftwidth=2' >> ~/.vimrc echo 'set expandtab' >> ~/.vimrc echo 'source <(kubectl completion bash)' >> ~/.bashrc echo 'alias k=kubectl' >> ~/.bashrc echo 'alias c=clear' >> ~/.bashrc echo 'complete -F __start_kubectl k' >> ~/.bashrc sed -i '1s/^/force_color_prompt=yes\n/' ~/.bashrc ### disable linux swap and remove any existing swap partitions swapoff -a sed -i '/\sswap\s/ s/^\(.*\)$/#\1/g' /etc/fstab ### remove packages kubeadm reset -f || true crictl rm --force $(crictl ps -a -q) || true apt-mark unhold kubelet kubeadm kubectl kubernetes-cni || true apt-get remove -y docker.io containerd kubelet kubeadm kubectl kubernetes-cni || true apt-get autoremove -y systemctl daemon-reload ### install podman . /etc/os-release echo "deb http://download.opensuse.org/repositories/devel:/kubic:/libcontainers:/stable/xUbuntu_${VERSION_ID}/ /" | sudo tee /etc/apt/sources.list.d/devel:kubic:libcontainers:testing.list curl -L "http://download.opensuse.org/repositories/devel:/kubic:/libcontainers:/stable/xUbuntu_${VERSION_ID}/Release.key" | sudo apt-key add - apt-get update -qq apt-get -qq -y install podman cri-tools containers-common rm /etc/apt/sources.list.d/devel:kubic:libcontainers:testing.list cat < /etc/apt/sources.list.d/kubernetes.list echo "deb [signed-by=/etc/apt/keyrings/kubernetes-1-27-apt-keyring.gpg] https://pkgs.k8s.io/core:/stable:/v1.27/deb/ /" | sudo tee -a /etc/apt/sources.list.d/kubernetes.list echo "deb [signed-by=/etc/apt/keyrings/kubernetes-1-28-apt-keyring.gpg] https://pkgs.k8s.io/core:/stable:/v1.28/deb/ /" | sudo tee -a /etc/apt/sources.list.d/kubernetes.list echo "deb [signed-by=/etc/apt/keyrings/kubernetes-1-29-apt-keyring.gpg] https://pkgs.k8s.io/core:/stable:/v1.29/deb/ /" | sudo tee -a /etc/apt/sources.list.d/kubernetes.list apt-get --allow-unauthenticated update apt-get --allow-unauthenticated install -y docker.io containerd kubelet=${KUBE_VERSION}-1.1 kubeadm=${KUBE_VERSION}-1.1 kubectl=${KUBE_VERSION}-1.1 kubernetes-cni apt-mark hold kubelet kubeadm kubectl kubernetes-cni ### install containerd 1.6 over apt-installed-version wget https://github.com/containerd/containerd/releases/download/v1.6.12/containerd-1.6.12-linux-${PLATFORM}.tar.gz tar xvf containerd-1.6.12-linux-${PLATFORM}.tar.gz systemctl stop containerd mv bin/* /usr/bin rm -rf bin containerd-1.6.12-linux-${PLATFORM}.tar.gz systemctl unmask containerd systemctl start containerd ### containerd cat < /etc/containerd/config.toml <