message
This commit is contained in:
parent
4f9d4c369d
commit
6e59d31aea
90
setup-container-old.sh
Executable file
90
setup-container-old.sh
Executable file
@ -0,0 +1,90 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
# script that runs
|
||||||
|
# https://kubernetes.io/docs/setup/production-environment/container-runtime
|
||||||
|
|
||||||
|
# setting MYOS variable
|
||||||
|
MYOS=$(hostnamectl | awk '/Operating/ { print $3 }')
|
||||||
|
OSVERSION=$(hostnamectl | awk '/Operating/ { print $4 }')
|
||||||
|
|
||||||
|
##### CentOS 7 config
|
||||||
|
if [ $MYOS = "CentOS" ]
|
||||||
|
then
|
||||||
|
echo setting up CentOS 7 with Docker
|
||||||
|
yum install -y vim yum-utils device-mapper-persistent-data lvm2
|
||||||
|
yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
|
||||||
|
|
||||||
|
# notice that only verified versions of Docker may be installed
|
||||||
|
# verify the documentation to check if a more recent version is available
|
||||||
|
|
||||||
|
yum install -y docker-ce
|
||||||
|
[ ! -d /etc/docker ] && mkdir /etc/docker
|
||||||
|
|
||||||
|
mkdir -p /etc/systemd/system/docker.service.d
|
||||||
|
|
||||||
|
|
||||||
|
cat > /etc/docker/daemon.json <<- EOF
|
||||||
|
{
|
||||||
|
"exec-opts": ["native.cgroupdriver=systemd"],
|
||||||
|
"log-driver": "json-file",
|
||||||
|
"log-opts": {
|
||||||
|
"max-size": "100m"
|
||||||
|
},
|
||||||
|
"storage-driver": "overlay2",
|
||||||
|
"storage-opts": [
|
||||||
|
"overlay2.override_kernel_check=true"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
EOF
|
||||||
|
|
||||||
|
|
||||||
|
systemctl daemon-reload
|
||||||
|
systemctl restart docker
|
||||||
|
systemctl enable docker
|
||||||
|
|
||||||
|
systemctl disable --now firewalld
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo printing MYOS $MYOS
|
||||||
|
|
||||||
|
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
|
||||||
|
# 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
|
||||||
|
|
||||||
@ -6,46 +6,6 @@
|
|||||||
MYOS=$(hostnamectl | awk '/Operating/ { print $3 }')
|
MYOS=$(hostnamectl | awk '/Operating/ { print $3 }')
|
||||||
OSVERSION=$(hostnamectl | awk '/Operating/ { print $4 }')
|
OSVERSION=$(hostnamectl | awk '/Operating/ { print $4 }')
|
||||||
|
|
||||||
##### CentOS 7 config
|
|
||||||
if [ $MYOS = "CentOS" ]
|
|
||||||
then
|
|
||||||
echo setting up CentOS 7 with Docker
|
|
||||||
yum install -y vim yum-utils device-mapper-persistent-data lvm2
|
|
||||||
yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
|
|
||||||
|
|
||||||
# notice that only verified versions of Docker may be installed
|
|
||||||
# verify the documentation to check if a more recent version is available
|
|
||||||
|
|
||||||
yum install -y docker-ce
|
|
||||||
[ ! -d /etc/docker ] && mkdir /etc/docker
|
|
||||||
|
|
||||||
mkdir -p /etc/systemd/system/docker.service.d
|
|
||||||
|
|
||||||
|
|
||||||
cat > /etc/docker/daemon.json <<- EOF
|
|
||||||
{
|
|
||||||
"exec-opts": ["native.cgroupdriver=systemd"],
|
|
||||||
"log-driver": "json-file",
|
|
||||||
"log-opts": {
|
|
||||||
"max-size": "100m"
|
|
||||||
},
|
|
||||||
"storage-driver": "overlay2",
|
|
||||||
"storage-opts": [
|
|
||||||
"overlay2.override_kernel_check=true"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
EOF
|
|
||||||
|
|
||||||
|
|
||||||
systemctl daemon-reload
|
|
||||||
systemctl restart docker
|
|
||||||
systemctl enable docker
|
|
||||||
|
|
||||||
systemctl disable --now firewalld
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo printing MYOS $MYOS
|
|
||||||
|
|
||||||
if [ $MYOS = "Ubuntu" ]
|
if [ $MYOS = "Ubuntu" ]
|
||||||
then
|
then
|
||||||
### setting up container runtime prereq
|
### setting up container runtime prereq
|
||||||
@ -68,7 +28,17 @@ then
|
|||||||
sudo sysctl --system
|
sudo sysctl --system
|
||||||
|
|
||||||
# (Install containerd)
|
# (Install containerd)
|
||||||
|
|
||||||
sudo apt-get update && sudo apt-get install -y 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-amd64.tar.gz
|
||||||
|
tar xvf containerd-1.6.15-linux-amd64.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
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user