install-k8s-on-ubuntu-2204/install-containerd.sh

34 lines
845 B
Bash
Raw Normal View History

2024-01-28 12:38:17 +02:00
#!/usr/bin/env bash
2024-01-27 19:33:25 +02:00
2024-01-27 19:54:51 +02:00
export DEBIAN_FRONTEND=noninteractive
2024-01-28 12:38:17 +02:00
apt install -y containerd wget
2024-01-27 19:33:25 +02:00
mkdir -p /etc/containerd
containerd config default | tee /etc/containerd/config.toml
2024-01-28 13:05:27 +02:00
sed -i -e "s@SystemdCgroup = false@SystemdCgroup = true@g" \
/etc/containerd/config.toml
2024-01-27 19:33:25 +02:00
echo "net.ipv4.ip_forward=1" > /etc/sysctl.d/010-k8s.conf
echo "br_netfilter" > /etc/modules-load.d/k8s.conf
sysctl --system
2024-01-28 12:38:17 +02:00
modprobe br_netfilter
2024-01-27 19:33:25 +02:00
systemctl restart containerd
2024-01-27 21:42:27 +02:00
cat <<EOF >/etc/crictl.yaml
runtime-endpoint: unix:///run/containerd/containerd.sock
image-endpoint: unix:///run/containerd/containerd.sock
EOF
2024-01-28 12:38:17 +02:00
VERSION="v1.28.0"
wget "https://github.com/kubernetes-sigs/cri-tools/releases/download/$VERSION/crictl-$VERSION-linux-amd64.tar.gz"
tar zxvf "crictl-$VERSION-linux-amd64.tar.gz" -C /usr/local/bin
rm -f "crictl-$VERSION-linux-amd64.tar.gz"
2024-01-27 21:42:27 +02:00
crictl ps
2024-01-28 12:38:17 +02:00