updated setup-container.sh and setup-kubetools.sh
This commit is contained in:
parent
16501ee4e0
commit
d775fd2f25
65
setup-container-previous-version.sh
Executable file
65
setup-container-previous-version.sh
Executable file
@ -0,0 +1,65 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
# 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
|
||||||
|
### setting up container runtime prereq
|
||||||
|
cat <<- EOF | sudo tee /etc/modules-load.d/containerd.conf
|
||||||
|
overlay
|
||||||
|
br_netfilter
|
||||||
|
EOF
|
||||||
|
|
||||||
|
sudo modprobe overlay
|
||||||
|
sudo modprobe br_netfilter
|
||||||
|
|
||||||
|
# Setup required sysctl params, these persist across reboots.
|
||||||
|
cat <<- EOF | sudo tee /etc/sysctl.d/99-kubernetes-cri.conf
|
||||||
|
net.bridge.bridge-nf-call-iptables = 1
|
||||||
|
net.ipv4.ip_forward = 1
|
||||||
|
net.bridge.bridge-nf-call-ip6tables = 1
|
||||||
|
EOF
|
||||||
|
|
||||||
|
# Apply sysctl params without reboot
|
||||||
|
sudo sysctl --system
|
||||||
|
|
||||||
|
# (Install containerd)
|
||||||
|
|
||||||
|
sudo apt-get update && sudo apt-get install -y containerd
|
||||||
|
# hopefully temporary bugfix as the containerd version provided in Ubu repo is tool old
|
||||||
|
# added Jan 26th 2023
|
||||||
|
# this needs to be updated when a recent enough containerd version will be in Ubuntu repos
|
||||||
|
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-${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
|
||||||
|
cat <<- TOML | sudo tee /etc/containerd/config.toml
|
||||||
|
version = 2
|
||||||
|
[plugins]
|
||||||
|
[plugins."io.containerd.grpc.v1.cri"]
|
||||||
|
[plugins."io.containerd.grpc.v1.cri".containerd]
|
||||||
|
discard_unpacked_layers = true
|
||||||
|
[plugins."io.containerd.grpc.v1.cri".containerd.runtimes]
|
||||||
|
[plugins."io.containerd.grpc.v1.cri".containerd.runtimes.runc]
|
||||||
|
runtime_type = "io.containerd.runc.v2"
|
||||||
|
[plugins."io.containerd.grpc.v1.cri".containerd.runtimes.runc.options]
|
||||||
|
SystemdCgroup = true
|
||||||
|
TOML
|
||||||
|
|
||||||
|
# Restart containerd
|
||||||
|
sudo systemctl restart containerd
|
||||||
|
fi
|
||||||
|
|
||||||
@ -11,13 +11,15 @@ OSVERSION=$(hostnamectl | awk '/Operating/ { print $4 }')
|
|||||||
[ $(arch) = aarch64 ] && PLATFORM=arm64
|
[ $(arch) = aarch64 ] && PLATFORM=arm64
|
||||||
[ $(arch) = x86_64 ] && PLATFORM=amd64
|
[ $(arch) = x86_64 ] && PLATFORM=amd64
|
||||||
|
|
||||||
|
sudo apt install -y jq
|
||||||
|
|
||||||
if [ $MYOS = "Ubuntu" ]
|
if [ $MYOS = "Ubuntu" ]
|
||||||
then
|
then
|
||||||
### setting up container runtime prereq
|
### setting up container runtime prereq
|
||||||
cat <<- EOF | sudo tee /etc/modules-load.d/containerd.conf
|
cat <<- EOF | sudo tee /etc/modules-load.d/containerd.conf
|
||||||
overlay
|
overlay
|
||||||
br_netfilter
|
br_netfilter
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
sudo modprobe overlay
|
sudo modprobe overlay
|
||||||
sudo modprobe br_netfilter
|
sudo modprobe br_netfilter
|
||||||
@ -27,23 +29,17 @@ then
|
|||||||
net.bridge.bridge-nf-call-iptables = 1
|
net.bridge.bridge-nf-call-iptables = 1
|
||||||
net.ipv4.ip_forward = 1
|
net.ipv4.ip_forward = 1
|
||||||
net.bridge.bridge-nf-call-ip6tables = 1
|
net.bridge.bridge-nf-call-ip6tables = 1
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
# Apply sysctl params without reboot
|
# Apply sysctl params without reboot
|
||||||
sudo sysctl --system
|
sudo sysctl --system
|
||||||
|
|
||||||
# (Install containerd)
|
# (Install containerd)
|
||||||
|
# getting rid of hard coded version numbers
|
||||||
sudo apt-get update && sudo apt-get install -y containerd
|
CONTAINERD_VERSION=$(curl -s https://api.github.com/repos/containerd/containerd/releases/latest | jq -r '.tag_name')
|
||||||
# hopefully temporary bugfix as the containerd version provided in Ubu repo is tool old
|
CONTAINERD_VERSION=${CONTAINERD_VERSION#v}
|
||||||
# added Jan 26th 2023
|
wget https://github.com/containerd/containerd/releases/download/v${CONTAINERD_VERSION}/containerd-${CONTAINERD_VERSION}-linux-${PLATFORM}.tar.gz
|
||||||
# this needs to be updated when a recent enough containerd version will be in Ubuntu repos
|
sudo tar xvf containerd-${CONTAINERD_VERSION}-linux-${PLATFORM}.tar.gz -C /usr/local
|
||||||
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-${PLATFORM}.tar.gz
|
|
||||||
tar xvf containerd-1.6.15-linux-${PLATFORM}.tar.gz
|
|
||||||
sudo mv bin/* /usr/bin/
|
|
||||||
# Configure containerd
|
# Configure containerd
|
||||||
sudo mkdir -p /etc/containerd
|
sudo mkdir -p /etc/containerd
|
||||||
cat <<- TOML | sudo tee /etc/containerd/config.toml
|
cat <<- TOML | sudo tee /etc/containerd/config.toml
|
||||||
@ -57,9 +53,31 @@ version = 2
|
|||||||
runtime_type = "io.containerd.runc.v2"
|
runtime_type = "io.containerd.runc.v2"
|
||||||
[plugins."io.containerd.grpc.v1.cri".containerd.runtimes.runc.options]
|
[plugins."io.containerd.grpc.v1.cri".containerd.runtimes.runc.options]
|
||||||
SystemdCgroup = true
|
SystemdCgroup = true
|
||||||
TOML
|
TOML
|
||||||
|
|
||||||
# Restart containerd
|
RUNC_VERSION=$(curl -s https://api.github.com/repos/opencontainers/runc/releases/latest | jq -r '.tag_name')
|
||||||
sudo systemctl restart containerd
|
|
||||||
|
wget https://github.com/opencontainers/runc/releases/download/${RUNC_VERSION}/runc.${PLATFORM}
|
||||||
|
sudo install -m 755 runc.${PLATFORM} /usr/local/sbin/runc
|
||||||
|
# Restart containerd
|
||||||
|
wget https://raw.githubusercontent.com/containerd/containerd/main/containerd.service
|
||||||
|
sudo mv containerd.service /usr/lib/systemd/system/
|
||||||
|
sudo systemctl daemon-reload
|
||||||
|
sudo systemctl enable --now containerd
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
exit
|
||||||
|
#### notes from history just in case
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# Fetch the latest release tag from GitHub API
|
||||||
|
LATEST_TAG=$(curl -s https://api.github.com/repos/opencontainers/runc/releases/latest | jq -r '.tag_name')
|
||||||
|
|
||||||
|
# Construct the download URL
|
||||||
|
DOWNLOAD_URL="https://github.com/opencontainers/runc/releases/download/${LATEST_TAG}/runc.amd64"
|
||||||
|
|
||||||
|
# Use wget to download the latest version
|
||||||
|
wget "$DOWNLOAD_URL"
|
||||||
|
|
||||||
|
echo "Downloaded $DOWNLOAD_URL"
|
||||||
|
|
||||||
|
|||||||
52
setup-kubetools-latestversion.sh
Executable file
52
setup-kubetools-latestversion.sh
Executable file
@ -0,0 +1,52 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
# kubeadm installation instructions as on
|
||||||
|
# https://kubernetes.io/docs/setup/production-environment/tools/kubeadm/install-kubeadm/
|
||||||
|
|
||||||
|
# this script supports Ubuntu 20.04 LTS and later only
|
||||||
|
# run this script with sudo
|
||||||
|
|
||||||
|
if ! [ $USER = root ]
|
||||||
|
then
|
||||||
|
echo run this script with sudo
|
||||||
|
exit 3
|
||||||
|
fi
|
||||||
|
|
||||||
|
# setting MYOS variable
|
||||||
|
MYOS=$(hostnamectl | awk '/Operating/ { print $3 }')
|
||||||
|
OSVERSION=$(hostnamectl | awk '/Operating/ { print $4 }')
|
||||||
|
|
||||||
|
if [ $MYOS = "Ubuntu" ]
|
||||||
|
then
|
||||||
|
echo RUNNING UBUNTU CONFIG
|
||||||
|
cat <<EOF | sudo tee /etc/modules-load.d/k8s.conf
|
||||||
|
br_netfilter
|
||||||
|
EOF
|
||||||
|
|
||||||
|
### update 5-3-2024
|
||||||
|
# sudo apt-get update && sudo apt-get install -y apt-transport-https curl
|
||||||
|
# curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo apt-key add -
|
||||||
|
# cat <<EOF | sudo tee /etc/apt/sources.list.d/kubernetes.list
|
||||||
|
# deb https://apt.kubernetes.io/ kubernetes-xenial main
|
||||||
|
#EOF
|
||||||
|
sudo apt-get update && sudo apt-get install -y apt-transport-https curl
|
||||||
|
curl -fsSL https://pkgs.k8s.io/core:/stable:/v1.28/deb/Release.key | sudo gpg --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:/v1.29/deb/ /' | sudo tee /etc/apt/sources.list.d/kubernetes.list
|
||||||
|
|
||||||
|
sudo apt-get update
|
||||||
|
sudo apt-get install -y kubelet kubeadm kubectl
|
||||||
|
sudo apt-mark hold kubelet kubeadm kubectl
|
||||||
|
swapoff -a
|
||||||
|
|
||||||
|
sed -i 's/\/swap/#\/swap/' /etc/fstab
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Set iptables bridging
|
||||||
|
cat <<EOF > /etc/sysctl.d/k8s.conf
|
||||||
|
net.bridge.bridge-nf-call-ip6tables = 1
|
||||||
|
net.bridge.bridge-nf-call-iptables = 1
|
||||||
|
EOF
|
||||||
|
sysctl --system
|
||||||
|
|
||||||
|
sudo crictl config --set \
|
||||||
|
runtime-endpoint=unix:///run/containerd/containerd.sock
|
||||||
|
echo 'after initializing the control node, follow instructions and use kubectl apply -f https://docs.projectcalico.org/manifests/calico.yaml to install the calico plugin (control node only). On the worker nodes, use sudo kubeadm join ... to join'
|
||||||
52
setup-kubetools-previousversion.sh
Executable file
52
setup-kubetools-previousversion.sh
Executable file
@ -0,0 +1,52 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
# kubeadm installation instructions as on
|
||||||
|
# https://kubernetes.io/docs/setup/production-environment/tools/kubeadm/install-kubeadm/
|
||||||
|
|
||||||
|
# this script supports Ubuntu 20.04 LTS and later only
|
||||||
|
# run this script with sudo
|
||||||
|
|
||||||
|
if ! [ $USER = root ]
|
||||||
|
then
|
||||||
|
echo run this script with sudo
|
||||||
|
exit 3
|
||||||
|
fi
|
||||||
|
|
||||||
|
# setting MYOS variable
|
||||||
|
MYOS=$(hostnamectl | awk '/Operating/ { print $3 }')
|
||||||
|
OSVERSION=$(hostnamectl | awk '/Operating/ { print $4 }')
|
||||||
|
|
||||||
|
if [ $MYOS = "Ubuntu" ]
|
||||||
|
then
|
||||||
|
echo RUNNING UBUNTU CONFIG
|
||||||
|
cat <<EOF | sudo tee /etc/modules-load.d/k8s.conf
|
||||||
|
br_netfilter
|
||||||
|
EOF
|
||||||
|
|
||||||
|
### update 5-3-2024
|
||||||
|
sudo apt-get update && sudo apt-get install -y apt-transport-https curl
|
||||||
|
curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo apt-key add -
|
||||||
|
cat <<EOF | sudo tee /etc/apt/sources.list.d/kubernetes.list
|
||||||
|
deb https://apt.kubernetes.io/ kubernetes-xenial main
|
||||||
|
EOF
|
||||||
|
# sudo apt-get update && sudo apt-get install -y apt-transport-https curl
|
||||||
|
# curl -fsSL https://pkgs.k8s.io/core:/stable:/v1.28/deb/Release.key | sudo gpg --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:/v1.28/deb/ /" | sudo tee /etc/apt/sources.list.d/kubernetes.list
|
||||||
|
|
||||||
|
|
||||||
|
sudo apt-get install -y kubelet kubeadm kubectl
|
||||||
|
sudo apt-mark hold kubelet kubeadm kubectl
|
||||||
|
swapoff -a
|
||||||
|
|
||||||
|
sed -i 's/\/swap/#\/swap/' /etc/fstab
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Set iptables bridging
|
||||||
|
cat <<EOF > /etc/sysctl.d/k8s.conf
|
||||||
|
net.bridge.bridge-nf-call-ip6tables = 1
|
||||||
|
net.bridge.bridge-nf-call-iptables = 1
|
||||||
|
EOF
|
||||||
|
sysctl --system
|
||||||
|
|
||||||
|
sudo crictl config --set \
|
||||||
|
runtime-endpoint=unix:///run/containerd/containerd.sock
|
||||||
|
echo 'after initializing the control node, follow instructions and use kubectl apply -f https://raw.githubusercontent.com/projectcalico/calico/v3.25.0/manifests/calico.yaml to install the calico plugin (control node only). On the worker nodes, use sudo kubeadm join ... to join'
|
||||||
@ -23,16 +23,16 @@ then
|
|||||||
EOF
|
EOF
|
||||||
|
|
||||||
### update 5-3-2024
|
### update 5-3-2024
|
||||||
sudo apt-get update && sudo apt-get install -y apt-transport-https curl
|
|
||||||
curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo apt-key add -
|
|
||||||
cat <<EOF | sudo tee /etc/apt/sources.list.d/kubernetes.list
|
|
||||||
deb https://apt.kubernetes.io/ kubernetes-xenial main
|
|
||||||
EOF
|
|
||||||
# sudo apt-get update && sudo apt-get install -y apt-transport-https curl
|
# sudo apt-get update && sudo apt-get install -y apt-transport-https curl
|
||||||
# curl -fsSL https://pkgs.k8s.io/core:/stable:/v1.28/deb/Release.key | sudo gpg --dearmor -o /etc/apt/keyrings/kubernetes-apt-keyring.gpg
|
# curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo apt-key add -
|
||||||
# echo "deb [signed-by=/etc/apt/keyrings/kubernetes-apt-keyring.gpg] https://pkgs.k8s.io/core:/stable:/v1.28/deb/ /" | sudo tee /etc/apt/sources.list.d/kubernetes.list
|
# cat <<EOF | sudo tee /etc/apt/sources.list.d/kubernetes.list
|
||||||
|
# deb https://apt.kubernetes.io/ kubernetes-xenial main
|
||||||
|
#EOF
|
||||||
|
sudo apt-get update && sudo apt-get install -y apt-transport-https curl
|
||||||
|
curl -fsSL https://pkgs.k8s.io/core:/stable:/v1.28/deb/Release.key | sudo gpg --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:/v1.29/deb/ /' | sudo tee /etc/apt/sources.list.d/kubernetes.list
|
||||||
|
|
||||||
|
sudo apt-get update
|
||||||
sudo apt-get install -y kubelet kubeadm kubectl
|
sudo apt-get install -y kubelet kubeadm kubectl
|
||||||
sudo apt-mark hold kubelet kubeadm kubectl
|
sudo apt-mark hold kubelet kubeadm kubectl
|
||||||
swapoff -a
|
swapoff -a
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user