This commit is contained in:
sandervanvugt 2023-03-14 13:25:42 +01:00
parent f2bda52363
commit 2b97f15b88
2 changed files with 10 additions and 31 deletions

View File

@ -2,9 +2,14 @@
# script that runs
# https://kubernetes.io/docs/setup/production-environment/container-runtime
# changes March 14 2023: introduced $PLATFORM to have this work on amd64 as well as arm64
# setting MYOS variable
MYOS=$(hostnamectl | awk '/Operating/ { print $3 }')
OSVERSION=$(hostnamectl | awk '/Operating/ { print $4 }')
# beta: building in ARM support
[ $(arch) = aarch64 ] && PLATFORM=arm64
[ $(arch) = x86_64 ] && PLATFORM=amd64
if [ $MYOS = "Ubuntu" ]
then
@ -36,8 +41,8 @@ then
sudo systemctl stop containerd
# cleanup old files from previous attempt if existing
[ -d bin ] && rm -rf bin
wget https://github.com/containerd/containerd/releases/download/v1.6.15/containerd-1.6.15-linux-amd64.tar.gz
tar xvf containerd-1.6.15-linux-amd64.tar.gz
wget https://github.com/containerd/containerd/releases/download/v1.6.15/containerd-1.6.15-linux-${PLATFORM}.tar.gz
tar xvf containerd-1.6.15-linux-${PLATFORM}.tar.gz
sudo mv bin/* /usr/bin/
# Configure containerd
sudo mkdir -p /etc/containerd

View File

@ -2,7 +2,7 @@
# kubeadm installation instructions as on
# https://kubernetes.io/docs/setup/production-environment/tools/kubeadm/install-kubeadm/
# this script supports centos 7 and Ubuntu 20.04 only
# this script supports Ubuntu 20.04 LTS and later only
# run this script with sudo
if ! [ $USER = root ]
@ -15,34 +15,6 @@ fi
MYOS=$(hostnamectl | awk '/Operating/ { print $3 }')
OSVERSION=$(hostnamectl | awk '/Operating/ { print $4 }')
##### CentOS 7 config
if [ $MYOS = "CentOS" ]
then
echo RUNNING CENTOS CONFIG
cat <<EOF | sudo tee /etc/yum.repos.d/kubernetes.repo
[kubernetes]
name=Kubernetes
baseurl=https://packages.cloud.google.com/yum/repos/kubernetes-el7-\$basearch
enabled=1
gpgcheck=1
repo_gpgcheck=1
gpgkey=https://packages.cloud.google.com/yum/doc/yum-key.gpg https://packages.cloud.google.com/yum/doc/rpm-package-key.gpg
exclude=kubelet kubeadm kubectl
EOF
# Set SELinux in permissive mode (effectively disabling it)
setenforce 0
sed -i 's/^SELINUX=enforcing$/SELINUX=permissive/' /etc/selinux/config
# disable swap (assuming that the name is /dev/centos/swap
sed -i 's/^\/dev\/mapper\/centos-swap/#\/dev\/mapper\/centos-swap/' /etc/fstab
swapoff /dev/mapper/centos-swap
yum install -y kubelet kubeadm kubectl --disableexcludes=kubernetes
systemctl enable --now kubelet
fi
if [ $MYOS = "Ubuntu" ]
then
echo RUNNING UBUNTU CONFIG
@ -70,3 +42,5 @@ net.bridge.bridge-nf-call-ip6tables = 1
net.bridge.bridge-nf-call-iptables = 1
EOF
sysctl --system
echo after initializing the cluster, follow instructions and use kubectl apply -f https://raw.githubusercontent.com/projectcalico/calico/v3.25.0/manifests/calico.yaml to install the calico plugin