Last active
December 20, 2021 06:09
-
-
Save michaelact/8353864bcfc34b0fb4468ef92e5932a7 to your computer and use it in GitHub Desktop.
Install k8s + CRI-O
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Create the .conf file to load the modules at bootup | |
cat <<EOF | sudo tee /etc/modules-load.d/crio.conf | |
overlay | |
br_netfilter | |
EOF | |
sudo modprobe overlay | |
sudo modprobe br_netfilter | |
# Set up 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 | |
sudo sysctl --system | |
sudo swapoff -a | |
# Install CRI-O | |
cat <<EOF | sudo tee /etc/apt/sources.list.d/devel:kubic:libcontainers:stable.list | |
deb https://download.opensuse.org/repositories/devel:/kubic:/libcontainers:/stable/$OS/ / | |
EOF | |
cat <<EOF | sudo tee /etc/apt/sources.list.d/devel:kubic:libcontainers:stable:cri-o:$VERSION.list | |
deb http://download.opensuse.org/repositories/devel:/kubic:/libcontainers:/stable:/cri-o:/$VERSION/$OS/ / | |
EOF | |
curl -L https://download.opensuse.org/repositories/devel:kubic:libcontainers:stable:cri-o:$VERSION/$OS/Release.key | sudo apt-key --keyring /etc/apt/trusted.gpg.d/libcontainers.gpg add - | |
curl -L https://download.opensuse.org/repositories/devel:/kubic:/libcontainers:/stable/$OS/Release.key | sudo apt-key --keyring /etc/apt/trusted.gpg.d/libcontainers.gpg add - | |
sudo apt-get update | |
sudo apt-get install -y buildah cri-o cri-o-runc | |
cat <<EOF | sudo tee /etc/crio/crio.conf.d/02-cgroup-manager.conf | |
[crio.runtime] | |
conmon_cgroup = "pod" | |
EOF | |
sudo systemctl daemon-reload | |
sudo systemctl enable crio --now | |
# Install Kubectl, Kubeadm, Kubelet | |
sudo apt-get update | |
sudo apt-get install -y apt-transport-https ca-certificates curl | |
sudo curl -fsSLo /usr/share/keyrings/kubernetes-archive-keyring.gpg https://packages.cloud.google.com/apt/doc/apt-key.gpg | |
echo "deb [signed-by=/usr/share/keyrings/kubernetes-archive-keyring.gpg] https://apt.kubernetes.io/ kubernetes-xenial main" | 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 | |
sudo systemctl enable kubelet | |
# Change Kubelet Configuration to use CRI-O | |
sudo echo "KUBELET_EXTRA_ARGS=--container-runtime=remote --container-runtime-endpoint=unix:///var/run/crio/crio.sock" >> /etc/systemd/system/kubelet.service.d/10-kubeadm.conf |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
eXample: