message
This commit is contained in:
parent
793b54a68c
commit
fdec84211f
81
setup-container-latest-version.sh
Normal file
81
setup-container-latest-version.sh
Normal file
@ -0,0 +1,81 @@
|
|||||||
|
#!/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)
|
||||||
|
# getting rid of hard coded version numbers
|
||||||
|
CONTAINERD_VERSION=$(curl -s https://api.github.com/repos/containerd/containerd/releases/latest | jq -r '.tag_name')
|
||||||
|
CONTAINERD_VERSION=${CONTAINERD_VERSION#v}
|
||||||
|
wget https://github.com/containerd/containerd/releases/download/v${CONTAINERD_VERSION}/containerd-${CONTAINERD_VERSION}-linux-${PLATFORM}.tar.gz
|
||||||
|
sudo tar xvf containerd-${CONTAINERD_VERSION}-linux-${PLATFORM}.tar.gz -C /usr/local
|
||||||
|
# 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
|
||||||
|
|
||||||
|
RUNC_VERSION=$(curl -s https://api.github.com/repos/opencontainers/runc/releases/latest | jq -r '.tag_name')
|
||||||
|
|
||||||
|
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
|
||||||
|
|
||||||
|
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"
|
||||||
|
|
||||||
@ -33,16 +33,11 @@ EOF
|
|||||||
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.7.13/containerd-1.7.13-linux-${PLATFORM}.tar.gz
|
|
||||||
sudo tar xvf containerd-1.7.13-linux-${PLATFORM}.tar.gz -C /usr/local
|
|
||||||
# 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
|
||||||
@ -58,9 +53,10 @@ version = 2
|
|||||||
SystemdCgroup = true
|
SystemdCgroup = true
|
||||||
TOML
|
TOML
|
||||||
|
|
||||||
|
RUNC_VERSION=$(curl -s https://api.github.com/repos/opencontainers/runc/releases/latest | jq -r '.tag_name')
|
||||||
|
|
||||||
wget https://github.com/opencontainers/runc/releases/download/v1.1.12/runc.amd64
|
wget https://github.com/opencontainers/runc/releases/download/${RUNC_VERSION}/runc.${PLATFORM}
|
||||||
sudo install -m 755 runc.amd64 /usr/local/sbin/runc
|
sudo install -m 755 runc.${PLATFORM} /usr/local/sbin/runc
|
||||||
# Restart containerd
|
# Restart containerd
|
||||||
wget https://raw.githubusercontent.com/containerd/containerd/main/containerd.service
|
wget https://raw.githubusercontent.com/containerd/containerd/main/containerd.service
|
||||||
sudo mv containerd.service /usr/lib/systemd/system/
|
sudo mv containerd.service /usr/lib/systemd/system/
|
||||||
@ -70,4 +66,16 @@ fi
|
|||||||
|
|
||||||
exit
|
exit
|
||||||
#### notes from history just in case
|
#### 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"
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user