Kubelet and static pods on Kubernetes
Author: Fabrice JAMMES (LinkedIn).
Objective
- Find the static pods of the control plane and the kubelet configuration
- Create a static pod, and understand its mirror pod
The control plane components of a kubeadm cluster (API server, etcd, scheduler, controller manager) are static pods: the kubelet runs them from files on the node, without the API server. Hardening them (CIS benchmark, audit logs, encryption at rest) means editing these files.
Prerequisites
The lab writes on a node: use a kind cluster of your own, never a shared one.
$CP is the control plane node: kind runs it as a docker container, open a shell in it with docker exec -it $CP bash.
Exercise 1: find the static pods
Find the kubelet process and its configuration file on the control plane node. Which directory holds the static pod manifests? Which pods are static pods?
Exercise 2: create a static pod
Create a static pod static-web (image nginx:1.27) in the default namespace on the control plane node. Then try to delete it with kubectl. What happens?
Exercise 3: delete the static pod
Delete the static pod for good.
Questions
- Why are the control plane components static pods?
- An attacker is root on a node. What can they do with the static pods?