Tour a kubeadm cluster
You have a one-node kubeadm cluster, control-1: it is the control plane and it also runs your Pods. Before you upgrade, back up or repair a cluster you need to know where its parts live, so this lab is a guided walk around one.
You will find the static Pod manifests that start the control plane, read the Service address range, the kubelet's cgroup driver, the container runtime and the CNI configuration, start a test Pod, ask the API server for its health, and list when the certificates expire. Every answer is saved as a small file under ~/tour/, which the checks read; open them in the Files tab.
Three challenges, eight tasks. Every task shows the command.
Task 1 of 8
List the static Pod manifests
Goal:
~/tour/static-pods.txtlists the files in/etc/kubernetes/manifests.Do it:
mkdir -p ~/tour sudo ls /etc/kubernetes/manifests | tee ~/tour/static-pods.txt kubectl -n kube-system get pods -o wideYou should see: four files,
etcd.yaml,kube-apiserver.yaml,kube-controller-manager.yamlandkube-scheduler.yaml, then four Pods inkube-systemwhose names end in-control-1.Why: the Pods with the node's name on the end are mirror Pods: the kubelet started them from those files and shows them to the API server. Delete one with kubectl and it comes straight back; remove the file and it goes. The folder is
sudoonly because the files hold certificate paths and flags.Task 2 of 8
Find the Service address range
Goal:
~/tour/service-cidr.txtholds the API server's--service-cluster-ip-range, for example10.96.0.0/12.Do it:
sudo grep -- --service-cluster-ip-range /etc/kubernetes/manifests/kube-apiserver.yaml sudo grep -o 'service-cluster-ip-range=[^ "]*' /etc/kubernetes/manifests/kube-apiserver.yaml | cut -d= -f2 | tee ~/tour/service-cidr.txt kubectl get service kubernetesYou should see: one range such as
10.96.0.0/12, and thekubernetesService's CLUSTER-IP inside it (usually the first address,10.96.0.1).Why: every ClusterIP Service gets an address from this range, and it must not overlap the Pod network or the nodes' own network. Exam questions about the cluster's settings are answered from these manifest files.
Task 3 of 8
Read the kubelet's cgroup driver
Goal:
~/tour/cgroup-driver.txtholds the kubelet'scgroupDriverfrom/var/lib/kubelet/config.yaml.Do it:
systemctl status kubelet --no-pager | head -5 sudo grep cgroupDriver /var/lib/kubelet/config.yaml sudo grep cgroupDriver /var/lib/kubelet/config.yaml | awk '{print $2}' | tee ~/tour/cgroup-driver.txtYou should see: the kubelet
active (running)as a systemd service, andsystemdas the driver.Why: the kubelet is the one component that is not a Pod: systemd runs it, and kubeadm writes its settings to
/var/lib/kubelet/config.yaml. The kubelet and containerd must use the same cgroup driver (systemdhere), or Pods fail in confusing ways.Task 4 of 8
Name the container runtime
Goal:
~/tour/runtime.txtholds the runtime and version the node reports, for examplecontainerd://2.1.4.Do it:
kubectl get node control-1 -o wide kubectl get node control-1 -o jsonpath='{.status.nodeInfo.containerRuntimeVersion}' | tee ~/tour/runtime.txt; echo sudo crictl ps --name kube-apiserverYou should see:
containerd://and a version, then the API server's container in thecrictllist.Why:
crictltalks to the runtime directly through the CRI, so it works even when the API server does not. It is the tool for a control plane that will not start.Task 5 of 8
Find the CNI configuration
Goal:
~/tour/cni.txtholds the name of the CNI configuration file in/etc/cni/net.d.Do it:
sudo ls -l /etc/cni/net.d/ sudo ls /etc/cni/net.d/ | grep conflist | tee ~/tour/cni.txt kubectl -n kube-system get pods -l k8s-app=calico-node -o wideYou should see:
10-calico.conflist(and acalico-kubeconfig), then onecalico-nodePod, Running.Why: the kubelet reads the first configuration file in
/etc/cni/net.dto know which network plugin sets up each Pod. No file there means no Pod networking, and the node reports NotReady. The folder is readable by root only (Calico keeps its credentials there), hencesudo.Task 6 of 8
Start a Pod and read its address
Goal: a Pod
helloin namespacetour, imagenginx:1.27-alpine, Running, with its IP saved in~/tour/pod-ip.txt.Do it:
kubectl create namespace tour kubectl -n tour run hello --image=nginx:1.27-alpine kubectl -n tour wait --for=condition=Ready pod/hello --timeout=120s kubectl -n tour get pod hello -o jsonpath='{.status.podIP}' | tee ~/tour/pod-ip.txt; echoYou should see:
pod/hello condition met, then an address such as10.244.x.y.Why: that address came from Calico's pool (the
--pod-network-cidrgiven tokubeadm init), not from the Service range you found in task 2. Pods and Services use different ranges on purpose.Task 7 of 8
Ask the API server how it is
Goal:
~/tour/readyz.txtholds the API server's verbose readiness report.Do it:
kubectl get --raw='/readyz?verbose' | tee ~/tour/readyz.txtYou should see: a list of
[+]... oklines, including[+]etcd ok, ending withreadyz check passed.Why:
/readyz(ready to serve) and/livez(alive) are what the kubelet's probes on the API server use. The verbose form names the failing part, which is quicker than reading logs when etcd is down.Task 8 of 8
Check when the certificates expire
Goal:
~/tour/certs.txtholds the output ofkubeadm certs check-expiration.Do it:
sudo kubeadm certs check-expiration | tee ~/tour/certs.txtYou should see: a table of certificates (
admin.conf,apiserver,etcd-serverand others) with about a year left, then the certificate authorities with about ten years.Why:
sudo kubeadm certs renew allrenews them (then restart the control plane Pods), andkubeadm upgrade applyrenews them for you. Knowing where to look is half of an exam question on certificates.
Run it on your own cluster
Register free and start with the taster hours when they are open. Your work is checked task by task.