Skip to content
Hands-on IT IT Drills

Day 0: Training Ground

Goal: Three VMs are ready for kubeadm: kernel, containerd, runc and the Kubernetes packages are installed. · Duration: approx. 60 min · Prerequisite: three VMs with Ubuntu 24.04

Briefing

CKA: Cluster Architecture, “Prepare underlying infrastructure” (part of the 25 %). In the exam the nodes are usually prepared – in operations you do this yourself. Anyone who has built it by hand once finds every fault faster later on.

  cp1 .126                 worker1 .228             worker2 .83
  control-plane            worker                   worker
  4 vCPU / 12 GB           2 vCPU / 4 GB            2 vCPU / 4 GB
        |________________________|________________________|
              172.16.0.0/24 · Pods 192.168.0.0/16 (Calico)

Replace the IPs with your own. All drills of this day run on all three VMs unless stated otherwise.

Drill 1: Hostnames and name resolution

Set the matching name on each VM, here for cp1:

sudo hostnamectl set-hostname cp1

On worker1 and worker2, use worker1 and worker2 accordingly. Then on all three:

printf '172.16.0.126 cp1\n172.16.0.228 worker1\n172.16.0.83 worker2\n' \
  | sudo tee -a /etc/hosts
getent hosts cp1 worker1 worker2

Expected:

172.16.0.126    cp1
172.16.0.228    worker1
172.16.0.83     worker2

Why? The node name in Kubernetes is the hostname. Unique names save you guesswork in kubectl get nodes later.

Save your progress? Sign up for free

Drill 2: Swap off, load kernel modules

swapon --show
free -h | head -2

Expected: swapon prints nothing, the swap line is missing or shows 0B.

               total        used        free      shared  buff/cache   available
Mem:           3.8Gi       714Mi       433Mi       1.9Mi       3.0Gi       3.1Gi

If swap is active: sudo swapoff -a and comment out the swap line in /etc/fstab. By default, the kubelet does not start with swap active.

printf 'overlay\nbr_netfilter\n' | sudo tee /etc/modules-load.d/k8s.conf
sudo modprobe overlay
sudo modprobe br_netfilter
lsmod | grep -E '^(overlay|br_netfilter)'

Expected: two lines, one with br_netfilter and one with overlay.

Save your progress? Sign up for free

Drill 3: sysctl for the pod network

cat <<'EOF' | sudo tee /etc/sysctl.d/k8s.conf
net.ipv4.ip_forward = 1
net.bridge.bridge-nf-call-iptables = 1
net.bridge.bridge-nf-call-ip6tables = 1
EOF
sudo sysctl --system >/dev/null
sysctl net.ipv4.ip_forward net.bridge.bridge-nf-call-iptables

Expected:

net.ipv4.ip_forward = 1
net.bridge.bridge-nf-call-iptables = 1

Why? Without IP forwarding, packets between pods do not leave the node; kubeadm init aborts with an error in the preflight check.

Save your progress? Sign up for free

Drill 4: Install containerd

The container runtime straight from the project, with checksum:

cd /tmp
V=2.4.2
U=https://github.com/containerd/containerd/releases/download/v$V
curl -sSLO $U/containerd-$V-linux-amd64.tar.gz
curl -sSLO $U/containerd-$V-linux-amd64.tar.gz.sha256sum
sha256sum -c containerd-$V-linux-amd64.tar.gz.sha256sum

Expected:

containerd-2.4.2-linux-amd64.tar.gz: OK
sudo tar Cxzf /usr/local containerd-$V-linux-amd64.tar.gz
sudo mkdir -p /usr/local/lib/systemd/system
sudo curl -sSL -o /usr/local/lib/systemd/system/containerd.service \
  https://raw.githubusercontent.com/containerd/containerd/v$V/containerd.service
containerd --version

Expected:

containerd github.com/containerd/containerd/v2 v2.4.2 b7a25261e029...

Save your progress? Sign up for free

Drill 5: runc and systemd cgroups

R=1.5.3
U=https://github.com/opencontainers/runc/releases/download/v$R
curl -sSLO $U/runc.amd64
curl -sSLO $U/runc.sha256sum
grep ' runc.amd64$' runc.sha256sum | sha256sum -c
sudo install -m 755 runc.amd64 /usr/local/sbin/runc
runc --version | head -1

Expected:

runc.amd64: OK
runc version 1.5.3

Now generate the default configuration and switch to the systemd cgroup driver – the kubelet has used it by default since Kubernetes 1.22, and the two must match:

sudo mkdir -p /etc/containerd
containerd config default | sudo tee /etc/containerd/config.toml >/dev/null
sudo sed -i 's/SystemdCgroup = false/SystemdCgroup = true/' /etc/containerd/config.toml
grep -n 'SystemdCgroup' /etc/containerd/config.toml
sudo systemctl daemon-reload
sudo systemctl enable --now containerd
systemctl is-active containerd

Expected:

89:            SystemdCgroup = true
active

Save your progress? Sign up for free

Drill 6: kubeadm, kubelet and kubectl

The packages come from the community repository pkgs.k8s.io. The repository is split per minor version – here v1.36, so that you practice a real upgrade to 1.37 on Day 13.

sudo apt-get update
sudo apt-get install -y apt-transport-https ca-certificates curl gpg
sudo mkdir -p -m 755 /etc/apt/keyrings
curl -fsSL https://pkgs.k8s.io/core:/stable:/v1.36/deb/Release.key \
  | sudo gpg --dearmor -o /etc/apt/keyrings/kubernetes-apt-keyring.gpg
K=/etc/apt/keyrings/kubernetes-apt-keyring.gpg
echo "deb [signed-by=$K] https://pkgs.k8s.io/core:/stable:/v1.36/deb/ /" \
  | sudo tee /etc/apt/sources.list.d/kubernetes.list
sudo apt-get update
apt-cache madison kubeadm | head -2

Expected:

   kubeadm | 1.36.6-1.1 | https://pkgs.k8s.io/core:/stable:/v1.36/deb  Packages
   kubeadm | 1.36.5-1.1 | https://pkgs.k8s.io/core:/stable:/v1.36/deb  Packages
sudo apt-get install -y kubelet=1.36.6-1.1 kubeadm=1.36.6-1.1 kubectl=1.36.6-1.1 \
  cri-tools
sudo apt-mark hold kubelet kubeadm kubectl
kubeadm version -o short

Expected:

kubelet set on hold.
kubeadm set on hold.
kubectl set on hold.
v1.36.6

Why hold? Otherwise an unintended apt upgrade would update components outside the upgrade order (Day 13).

Save your progress? Sign up for free

Drill 7: Point crictl at containerd

crictl talks to any CRI runtime – your tool when kubectl no longer works.

cat <<'EOF' | sudo tee /etc/crictl.yaml
runtime-endpoint: unix:///run/containerd/containerd.sock
image-endpoint: unix:///run/containerd/containerd.sock
EOF
sudo crictl version

Expected:

Version:  0.1.0
RuntimeName:  containerd
RuntimeVersion:  v2.4.2
RuntimeApiVersion:  v1

Save your progress? Sign up for free

Exercise: Speed Drills

  1. Show which packages are on hold. Target time: 15 s
  2. Check whether containerd uses the systemd cgroup driver – via the CRI, not via the file. Target time: 30 s
  3. Check in one command whether IP forwarding is active. Target time: 15 s

Solution

apt-mark showhold
sudo crictl info | grep -i systemdcgroup
sysctl net.ipv4.ip_forward

Expected:

kubeadm
kubectl
kubelet
            "SystemdCgroup": true
net.ipv4.ip_forward = 1

Save your progress? Sign up for free

Checkpoint

On each of the three VMs:

systemctl is-active containerd

Expected: active

kubeadm version -o short

Expected: v1.36.6

swapon --show | wc -l

Expected: 0

systemctl is-active kubelet

Expected: activating – the kubelet restarts in a loop because it has no configuration yet. That changes with kubeadm init and kubeadm join on Day 1 (depending on timing, it may also show active).

Challenge

Find out which pause image (sandbox image) containerd uses for pods.

Hint: It is in the containerd configuration.

Solution

grep -n "sandbox = " /etc/containerd/config.toml

Expected:

28:      sandbox = 'registry.k8s.io/pause:3.10.2'

Save your progress? Sign up for free

Exam Tip

  • In the exam, containerd and the packages are usually already installed. The question is more likely “why is this node NotReady” – then you check exactly today’s points.
  • pkgs.k8s.io has one repository per minor version. For an upgrade you have to adjust the line in kubernetes.list (Day 13).

Enterprise Note

  • Nodes are not built by hand but with images (Packer), Ansible or cloud-init.
  • Package sources are mirrored (Artifactory, Nexus, apt-cacher) so that builds are reproducible.
  • Instead of bare VMs, many teams use ready-made distributions (RKE2, Talos, OpenShift) – kubeadm remains the reference tool that the exam builds on.