Skip to content
This repository was archived by the owner on Aug 12, 2025. It is now read-only.

Commit ff5d408

Browse files
authored
Merge pull request #216 from rawkode/feature/adopt-containerd-cri
✨ use containerd as CRI
2 parents e966039 + e5e4e8f commit ff5d408

File tree

1 file changed

+34
-12
lines changed

1 file changed

+34
-12
lines changed

templates/cluster-template.yaml

Lines changed: 34 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -40,20 +40,31 @@ spec:
4040
- sed -ri '/\sswap\s/s/^#?/#/' /etc/fstab
4141
- swapoff -a
4242
- mount -a
43+
- |
44+
cat <<EOF | sudo tee /etc/modules-load.d/containerd.conf
45+
overlay
46+
br_netfilter
47+
EOF
48+
- modprobe overlay
49+
- modprobe br_netfilter
50+
- |
51+
cat <<EOF | sudo tee /etc/sysctl.d/99-kubernetes-cri.conf
52+
net.bridge.bridge-nf-call-iptables = 1
53+
net.ipv4.ip_forward = 1
54+
net.bridge.bridge-nf-call-ip6tables = 1
55+
EOF
56+
- sysctl --system
4357
- apt-get -y update
4458
- DEBIAN_FRONTEND=noninteractive apt-get install -y apt-transport-https curl
4559
- curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo apt-key add -
4660
- echo "deb https://apt.kubernetes.io/ kubernetes-xenial main" > /etc/apt/sources.list.d/kubernetes.list
47-
- curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
48-
- apt-key fingerprint 0EBFCD88
49-
- add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
5061
- apt-get update -y
5162
- TRIMMED_KUBERNETES_VERSION=$(echo ${KUBERNETES_VERSION} | sed 's/\./\\./g' | sed 's/^v//')
5263
- RESOLVED_KUBERNETES_VERSION=$(apt-cache policy kubelet | awk -v VERSION=$${TRIMMED_KUBERNETES_VERSION} '$1~ VERSION { print $1 }' | head -n1)
53-
- apt-get install -y ca-certificates socat jq ebtables apt-transport-https cloud-utils prips docker-ce docker-ce-cli containerd.io kubelet=$${RESOLVED_KUBERNETES_VERSION} kubeadm=$${RESOLVED_KUBERNETES_VERSION} kubectl=$${RESOLVED_KUBERNETES_VERSION}
64+
- apt-get install -y ca-certificates socat jq ebtables apt-transport-https cloud-utils prips containerd kubelet=$${RESOLVED_KUBERNETES_VERSION} kubeadm=$${RESOLVED_KUBERNETES_VERSION} kubectl=$${RESOLVED_KUBERNETES_VERSION}
5465
- systemctl daemon-reload
55-
- systemctl enable docker
56-
- systemctl start docker
66+
- systemctl enable containerd
67+
- systemctl start containerd
5768
- ping -c 3 -q {{ .controlPlaneEndpoint }} && echo OK || ip addr add {{ .controlPlaneEndpoint }} dev lo
5869
---
5970
apiVersion: infrastructure.cluster.x-k8s.io/v1alpha3
@@ -156,20 +167,31 @@ spec:
156167
- sed -ri '/\sswap\s/s/^#?/#/' /etc/fstab
157168
- swapoff -a
158169
- mount -a
170+
- |
171+
cat <<EOF | sudo tee /etc/modules-load.d/containerd.conf
172+
overlay
173+
br_netfilter
174+
EOF
175+
- modprobe overlay
176+
- modprobe br_netfilter
177+
- |
178+
cat <<EOF | sudo tee /etc/sysctl.d/99-kubernetes-cri.conf
179+
net.bridge.bridge-nf-call-iptables = 1
180+
net.ipv4.ip_forward = 1
181+
net.bridge.bridge-nf-call-ip6tables = 1
182+
EOF
183+
- sysctl --system
159184
- apt-get -y update
160185
- DEBIAN_FRONTEND=noninteractive apt-get install -y apt-transport-https curl
161186
- curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo apt-key add -
162187
- echo "deb https://apt.kubernetes.io/ kubernetes-xenial main" > /etc/apt/sources.list.d/kubernetes.list
163-
- curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
164-
- apt-key fingerprint 0EBFCD88
165-
- add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
166188
- apt-get update -y
167189
- TRIMMED_KUBERNETES_VERSION=$(echo ${KUBERNETES_VERSION} | sed 's/\./\\./g' | sed 's/^v//')
168190
- RESOLVED_KUBERNETES_VERSION=$(apt-cache policy kubelet | awk -v VERSION=$${TRIMMED_KUBERNETES_VERSION} '$1~ VERSION { print $1 }' | head -n1)
169-
- apt-get install -y ca-certificates socat jq ebtables apt-transport-https cloud-utils prips docker-ce docker-ce-cli containerd.io kubelet=$${RESOLVED_KUBERNETES_VERSION} kubeadm=$${RESOLVED_KUBERNETES_VERSION} kubectl=$${RESOLVED_KUBERNETES_VERSION}
191+
- apt-get install -y ca-certificates socat jq ebtables apt-transport-https cloud-utils prips containerd kubelet=$${RESOLVED_KUBERNETES_VERSION} kubeadm=$${RESOLVED_KUBERNETES_VERSION} kubectl=$${RESOLVED_KUBERNETES_VERSION}
170192
- systemctl daemon-reload
171-
- systemctl enable docker
172-
- systemctl start docker
193+
- systemctl enable containerd
194+
- systemctl start containerd
173195
joinConfiguration:
174196
nodeRegistration:
175197
kubeletExtraArgs:

0 commit comments

Comments
 (0)