Skip to content

Commit 79eff06

Browse files
committed
Avoid relying on extra kubernetes packages
The second-party package of "cri-tools" (crictl) and also the third-party package "kubernetes-cni" (cni-plugins) will go away. So don't rely on them being installed, but just use "ctr" and "/usr/local/libexec/cni" instead from the nerdctl-full install. Signed-off-by: Anders F Björklund <anders.f.bjorklund@gmail.com>
1 parent 9873c5e commit 79eff06

File tree

1 file changed

+3
-9
lines changed

1 file changed

+3
-9
lines changed

templates/k8s.yaml

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -47,14 +47,6 @@ provision:
4747
echo "deb [signed-by=/etc/apt/keyrings/kubernetes-apt-keyring.gpg] https://pkgs.k8s.io/core:/stable:/v${VERSION}/deb/ /" | sudo tee /etc/apt/sources.list.d/kubernetes.list
4848
curl -fsSL https://pkgs.k8s.io/core:/stable:/v${VERSION}/deb/Release.key | sudo gpg --dearmor -o /etc/apt/keyrings/kubernetes-apt-keyring.gpg
4949
apt-get update
50-
# cri-tools
51-
apt-get install -y cri-tools
52-
cat <<EOF | sudo tee /etc/crictl.yaml
53-
runtime-endpoint: unix:///run/containerd/containerd.sock
54-
EOF
55-
# cni-plugins
56-
apt-get install -y kubernetes-cni
57-
rm -f /etc/cni/net.d/*.conf*
5850
apt-get install -y kubelet kubeadm kubectl && apt-mark hold kubelet kubeadm kubectl
5951
systemctl enable --now kubelet
6052
# See <https://kubernetes.io/docs/setup/production-environment/container-runtimes/>
@@ -77,6 +69,8 @@ provision:
7769
runtime_type = "io.containerd.runc.v2"
7870
[plugins."io.containerd.grpc.v1.cri".containerd.runtimes.runc.options]
7971
SystemdCgroup = true
72+
[plugins."io.containerd.cri.v1.runtime".cni]
73+
bin_dirs = ["/usr/local/libexec/cni","/opt/cni/bin"]
8074
EOF
8175
systemctl restart containerd
8276
# See <https://kubernetes.io/docs/setup/production-environment/tools/kubeadm/create-cluster-kubeadm/>
@@ -140,7 +134,7 @@ probes:
140134
script: |
141135
#!/bin/bash
142136
set -eux -o pipefail
143-
if ! timeout 30s bash -c "images=\"$(kubeadm config images list)\"; until for image in \$images; do sudo crictl image -q \$image | grep -q sha256; done; do sleep 3; done"; then
137+
if ! timeout 30s bash -c "images=\"$(kubeadm config images list)\"; until for image in \$images; do sudo ctr -n k8s.io image inspect \$image >/dev/null; done; do sleep 3; done"; then
144138
echo >&2 "k8s images are not pulled yet"
145139
exit 1
146140
fi

0 commit comments

Comments
 (0)