Kubeadm with containerd

I’m trying to install Kubernetes with Kubeadm on version 1.25.3, which is the version the exam is on, using ubuntu 22.04 on freshly provisioned AWS ec2 instances. Kubernetes discontinued support for the docker CRI back in version 1.24, but the CKA course still has you using docker with Kubernetes 1.18. I tried to swap out docker using Containerd, and I was able to Kubeadm init successfully, but all of my static pods are repeatedly crashing. I can’t do anything with kubectl because the api pod won’t stay up long enough, and I just get the error The connection to the server 10.0.0.10:6443 was refused - did you specify the right host or port?

The kubelet service is running, but I see a ton of errors in the journal all from failing to talk to the Kubernetes API, which makes sense because the API pod is not running.

I’ve tried both weave and calico CNI, but to be honest the problem starts before I apply the CNI yaml.

Hi @Donovan-Hubbard
i)
There are many pre-requisite you have to do before you install k8s on aws ec2. Did you get a chance to follow that?

ii)
k8s exam supports only Ubuntu version 18.04 & 20.04 . So I recommend you to practice on similar environment.

iii)
please try to follow these links:

Thank you.

After looking at this further I was able to track down that the api server was failing because it was failing to connect to the etcd pod. The etcd pod was being terminated by the kubelet.

After googling around some more I found this blog, Who's killing my pods? | (blog 'zezin), that specified the problem was caused by a cgroup mismatch. The kubelet was expecting cgroup v2 and Containerd was using cgroup v2. This was solved by adding the following to my /etc/containerd/config.toml.

# Content of file /etc/containerd/config.toml
version = 2
[plugins]
  [plugins."io.containerd.grpc.v1.cri"]
   [plugins."io.containerd.grpc.v1.cri".containerd]
      [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