Skip to content
Hands-on IT IT Drills

Day 1: kubeadm init and join

Goal: A cluster of one control plane and two workers is running, with Calico as the pod network. · Duration: approx. 60 min · Prerequisite: Day 0

Briefing

CKA: “Create and manage Kubernetes clusters using kubeadm” (part of the 25 %).

  • kubeadm init generates certificates, kubeconfigs and the control plane as static pods.
  • Without a CNI plugin, the nodes stay NotReady and CoreDNS stays Pending.
  • kubeadm join attaches workers with a bootstrap token and the CA hash.
  • Afterwards you know where every component lives – the foundation for all troubleshooting.

Drill 1: Initialize the control plane

Only on cp1:

sudo kubeadm init --kubernetes-version=v1.36.6 \
  --apiserver-advertise-address=172.16.0.126 \
  --pod-network-cidr=192.168.0.0/16

Expected (shortened):

[addons] Applied essential addon: CoreDNS
[addons] Applied essential addon: kube-proxy

Your Kubernetes control-plane has initialized successfully!
...
kubeadm join 172.16.0.126:6443 --token 7fx3pe.4hiaoxeepjqiqkoe \
    --discovery-token-ca-cert-hash sha256:74b96a6bf7d68a57229d66b0384ab2d788d64ae7eb...

Why --pod-network-cidr? Calico uses 192.168.0.0/16 by default, and the controller manager hands out the pod networks to the nodes from it. The network must not overlap with your VM network.

Save your progress? Sign up for free

Drill 2: Set up kubectl

mkdir -p $HOME/.kube
sudo cp /etc/kubernetes/admin.conf $HOME/.kube/config
sudo chown $(id -u):$(id -g) $HOME/.kube/config
kubectl get nodes
kubectl get pods -n kube-system

Expected:

NAME   STATUS     ROLES           AGE   VERSION
cp1    NotReady   control-plane   13s   v1.36.6
NAME                          READY   STATUS    RESTARTS   AGE
coredns-589f44dc88-c9tfc      0/1     Pending   0          4s
coredns-589f44dc88-tdzsw      0/1     Pending   0          4s
etcd-cp1                      1/1     Running   0          9s
kube-apiserver-cp1            1/1     Running   0          11s
kube-controller-manager-cp1   1/1     Running   0          9s
kube-proxy-85nkd              1/1     Running   0          4s
kube-scheduler-cp1            1/1     Running   0          9s

NotReady and Pending are correct here: the pod network is still missing.

Save your progress? Sign up for free

Drill 3: Install Calico

Calico comes with an operator. First the CRDs, then the operator, then the configuration:

C=https://raw.githubusercontent.com/projectcalico/calico/v3.33.1/manifests
kubectl create -f $C/operator-crds.yaml
kubectl create -f $C/tigera-operator.yaml
kubectl create -f $C/custom-resources.yaml

Expected (last lines):

installation.operator.tigera.io/default created
apiserver.operator.tigera.io/default created
goldmane.operator.tigera.io/default created
whisker.operator.tigera.io/default created

The custom-resources.yaml sets the IP pool to 192.168.0.0/16 – matching Drill 1. Wait until everything is available:

kubectl wait --for=condition=Available tigerastatus --all --timeout=300s
kubectl get tigerastatus

Expected:

NAME        AVAILABLE   PROGRESSING   DEGRADED   SINCE   MESSAGE
apiserver   True        False         False      16s     All objects available
calico      True        False         False      66s     All objects available
goldmane    True        False         False      6s      All objects available
ippools     True        False         False      2m51s   All objects available
tiers       True        False         False      11s     All objects available
whisker     True        False         False      1s      All objects available

Tip: During the first two minutes, tigerastatus shows messages like the server is currently unable to handle the request. That is the Calico API server still starting up – just wait.

Save your progress? Sign up for free

Drill 4: Attach the workers

The token from Drill 1 is valid for 24 hours. You can generate a fresh join command at any time:

kubeadm token create --print-join-command

Expected:

kubeadm join 172.16.0.126:6443 --token 7hfiwr.s013h2vr0prmgukn \
  --discovery-token-ca-cert-hash sha256:74b9...

Run this command with sudo on worker1 and worker2:

sudo kubeadm join 172.16.0.126:6443 --token <TOKEN> \
  --discovery-token-ca-cert-hash sha256:<HASH>

Expected (last lines):

* The Kubelet was informed of the new secure connection details.

Run 'kubectl get nodes' on the control-plane to see this node join the cluster.

Back on cp1:

kubectl wait --for=condition=Ready nodes --all --timeout=300s
kubectl get nodes -o wide

Expected (shortened):

NAME      STATUS   ROLES           VERSION   INTERNAL-IP    ...   CONTAINER-RUNTIME
cp1       Ready    control-plane   v1.36.6   172.16.0.126   ...   containerd://2.4.2
worker1   Ready    <none>          v1.36.6   172.16.0.228   ...   containerd://2.4.2
worker2   Ready    <none>          v1.36.6   172.16.0.83    ...   containerd://2.4.2

Save your progress? Sign up for free

Drill 5: Tour – static pods

The control plane does not run as a Deployment but as static pods: the kubelet on cp1 reads manifests from a directory and starts them itself.

sudo grep -E 'staticPodPath|cgroupDriver' /var/lib/kubelet/config.yaml
sudo ls /etc/kubernetes/manifests

Expected:

cgroupDriver: systemd
staticPodPath: /etc/kubernetes/manifests
etcd.yaml
kube-apiserver.yaml
kube-controller-manager.yaml
kube-scheduler.yaml

Who owns the API server pod?

kubectl get pod -n kube-system kube-apiserver-cp1 \
  -o jsonpath='{.metadata.ownerReferences[0].kind}{"\n"}'

Expected: Node – a mirror pod. Deleting it via kubectl achieves nothing; you can only change or remove it via the file in the manifest directory.

The most important API server flags:

sudo grep -E -- '--(etcd-servers|service-cluster-ip-range)=' \
  /etc/kubernetes/manifests/kube-apiserver.yaml
sudo grep -E -- '--(authorization-mode|advertise-address)=' \
  /etc/kubernetes/manifests/kube-apiserver.yaml

Expected:

    - --etcd-servers=https://127.0.0.1:2379
    - --service-cluster-ip-range=10.96.0.0/12
    - --advertise-address=172.16.0.126
    - --authorization-mode=Node,RBAC

Save your progress? Sign up for free

Drill 6: Tour – certificates and kubeconfigs

ls /etc/kubernetes
sudo kubeadm certs check-expiration | head -8

Expected (shortened):

admin.conf  controller-manager.conf  kubelet.conf  manifests  pki  scheduler.conf
super-admin.conf
CERTIFICATE                EXPIRES                  RESIDUAL TIME   CERTIFICATE AUTH...
admin.conf                 Nov 17, 2027 21:11 UTC   364d            ca
apiserver                  Nov 17, 2027 21:11 UTC   364d            ca
apiserver-etcd-client      Nov 17, 2027 21:11 UTC   364d            etcd-ca

Which names is the API server certificate valid for?

sudo openssl x509 -in /etc/kubernetes/pki/apiserver.crt -noout -ext subjectAltName

Expected:

X509v3 Subject Alternative Name:
    DNS:cp1, DNS:kubernetes, DNS:kubernetes.default, DNS:kubernetes.default.svc,
    DNS:kubernetes.default.svc.cluster.local, IP Address:10.96.0.1,
    IP Address:172.16.0.126

admin.conf is your admin kubeconfig, super-admin.conf is an emergency access that bypasses RBAC – lock it away safely. Certificates expire after one year (Day 13).

Save your progress? Sign up for free

Drill 7: Smoke test

kubectl create deployment web --image=nginx:1.29 --replicas=2
kubectl expose deployment web --port=80
kubectl rollout status deployment web
kubectl get pods -o wide

Expected (shortened):

deployment "web" successfully rolled out
NAME                   READY   STATUS    RESTARTS   AGE   IP                NODE
web-795767664d-7rh28   1/1     Running   0          22s   192.168.235.137   worker1
web-795767664d-sxn8l   1/1     Running   0          22s   192.168.189.66    worker2

The pods only land on the workers: cp1 has the taint node-role.kubernetes.io/control-plane:NoSchedule. Now test DNS and the Service:

kubectl run test --image=busybox:1.37 --rm -it --restart=Never -- \
  sh -c 'nslookup web.default.svc.cluster.local; wget -qO- -T5 web | grep title'

Expected (shortened):

Server:     10.96.0.10
Name:   web.default.svc.cluster.local
Address: 10.103.215.8
<title>Welcome to nginx!</title>

Clean up:

kubectl delete deployment,service web

Save your progress? Sign up for free

Exercise: Speed Drills

  1. Generate a new join command for a worker. Target time: 15 s
  2. Show the taints of cp1. Target time: 30 s
  3. Find the cluster’s pod and service networks without looking at manifests. Target time: 60 s

Solution

kubeadm token create --print-join-command
kubectl get node cp1 -o jsonpath='{.spec.taints}{"\n"}'
kubectl get cm -n kube-system kubeadm-config \
  -o jsonpath='{.data.ClusterConfiguration}' | grep -E 'podSubnet|serviceSubnet'

Expected:

kubeadm join 172.16.0.126:6443 --token ...
[{"effect":"NoSchedule","key":"node-role.kubernetes.io/control-plane"}]
  podSubnet: 192.168.0.0/16
  serviceSubnet: 10.96.0.0/12

Save your progress? Sign up for free

Checkpoint

kubectl get nodes

Expected: three nodes, all Ready, version v1.36.6.

kubectl get pods -n kube-system --field-selector=status.phase!=Running

Expected: No resources found in kube-system namespace.

kubectl get tigerastatus calico

Expected: AVAILABLE is True.

Challenge

Where does etcd store its data, and on which addresses does it accept client connections?

Hint: etcd is a static pod.

Solution

sudo grep -E '^\s+- --(data-dir|listen-client-urls)' /etc/kubernetes/manifests/etcd.yaml

Expected:

    - --data-dir=/var/lib/etcd
    - --listen-client-urls=https://127.0.0.1:2379,https://172.16.0.126:2379

You will need the data directory on Day 13 for the etcd restore.

Save your progress? Sign up for free

Exam Tip

  • Static pods: create, change or move a manifest in /etc/kubernetes/manifests – the kubelet reacts within seconds. Exam tasks like to test this.
  • Remember kubeadm token create --print-join-command; in the exam the init token has often expired.

Enterprise Note

  • A single control plane is a single point of failure – production needs three (Day 16).
  • kubeadm init belongs in a configuration file (--config) that is version-controlled.
  • Keep bootstrap tokens short-lived (--ttl) and delete them after the join.
  • super-admin.conf and ca.key belong in a vault, not on the node’s disk.