Static Pods

Difficulty: Advanced

Question

What are Static Pods in Kubernetes, how are they different from normal Pods, and why does kubeadm use them for the control plane?

Answer

Static Pods are Pods that the kubelet on a node runs directly from manifest files in a local directory (on kubeadm clusters, /etc/kubernetes/manifests), without the API server or scheduler being involved. The kubelet watches that directory, starts any Pod defined there, and restarts it if it dies. To make them visible, the kubelet creates a read-only mirror Pod in the API server, but you cannot manage the real Pod through kubectl.

How they work

  • The directory is set by staticPodPath in the kubelet's configuration file (the older --pod-manifest-path flag is deprecated). The kubelet can also fetch manifests from a URL.
  • The kubelet periodically rescans the directory. Adding a file starts a Pod, editing it restarts the Pod with the new spec, deleting it stops the Pod.
  • No scheduler: the Pod always runs on the node whose disk holds the file.
  • The mirror Pod's name is the manifest's Pod name suffixed with the node name, for example kube-apiserver-cp-1.

Why kubeadm uses them for the control plane

There is a chicken-and-egg problem: you cannot schedule the API server through the API server before it exists. kubeadm solves this by writing static Pod manifests for:

  • etcd
  • kube-apiserver
  • kube-controller-manager
  • kube-scheduler

The kubelet on each control plane node starts them from disk. Once the API server is up, mirror Pods appear in kube-system, so kubectl get pods -n kube-system shows them like any other Pod. Upgrading a component, such as adding an API server flag, means editing the manifest file on that node.

Managed services (EKS, GKE, AKS) hide the control plane entirely, so you mostly meet static Pods on self-managed kubeadm clusters, in CKA exam tasks, and in local tools like kind.

Static Pods vs other ways to run Pods

Static PodDaemonSet PodDeployment Pod
Created bykubelet from a local fileDaemonSet controllerReplicaSet controller
Needs API server to startNoYesYes
Scheduler involvedNoYes (default scheduler)Yes
Managed with kubectlNo, only a mirror PodYesYes
Runs onThe node with the fileEvery eligible nodeWherever scheduled

Gotchas

  • kubectl delete pod kube-apiserver-cp-1 only deletes the mirror Pod; the kubelet recreates it almost immediately. Remove or move the manifest file to stop it.
  • A static Pod spec cannot reference other API objects such as ServiceAccounts, ConfigMaps or Secrets, and ephemeral containers are not supported. Configuration comes from host files mounted with hostPath.
  • A YAML typo in a control plane manifest means the API server silently fails to start, and kubectl stops working. Debug on the node with crictl ps -a, crictl logs <id> and journalctl -u kubelet.
  • To find the directory on any node, check staticPodPath in /var/lib/kubelet/config.yaml.
How a static Pod is started. The kubelet runs the Pod from a local file and only reports it to the API server.
  1. Manifest in /etc/kubernetes/manifests: A normal Pod YAML file on the node's disk.
  2. kubelet scans directory: Detects new, changed or removed files.
  3. Runtime starts containers: No scheduler or API server needed.
  4. Mirror Pod in API server: Read-only copy named pod-name plus node name.

Code examples

Finding and inspecting static Pods

# On a control plane node: where does the kubelet look?
sudo grep staticPodPath /var/lib/kubelet/config.yaml
# staticPodPath: /etc/kubernetes/manifests

ls /etc/kubernetes/manifests
# etcd.yaml  kube-apiserver.yaml  kube-controller-manager.yaml  kube-scheduler.yaml

# From anywhere: mirror Pods carry the node name suffix
kubectl get pods -n kube-system -o wide | grep cp-1

# If the API server is down, debug with the runtime directly
sudo crictl ps -a | grep kube-apiserver
sudo journalctl -u kubelet --since "10 min ago"

Static Pods are managed through files on the node, so debugging them often happens on the node with crictl and journalctl.

A simple custom static Pod

# Save as /etc/kubernetes/manifests/node-probe.yaml on the node
apiVersion: v1
kind: Pod
metadata:
  name: node-probe
  namespace: kube-system
spec:
  containers:
    - name: probe
      image: busybox:1.36
      command: ["sh", "-c", "while true; do date; sleep 60; done"]

The kubelet starts this as soon as the file appears; deleting the file is the only way to stop it permanently.

Key points

  • Static Pods are run by the kubelet from local files, not by the API server or scheduler.
  • Default kubeadm path: /etc/kubernetes/manifests, configured by staticPodPath.
  • Mirror Pods make them visible in kubectl but deleting the mirror does nothing lasting.
  • kubeadm runs etcd, kube-apiserver, controller-manager and scheduler as static Pods.
  • Static Pods cannot reference ConfigMaps, Secrets or ServiceAccounts.

Common follow-up questions

  • How would you change a flag on the kube-apiserver in a kubeadm cluster?
  • How is a static Pod different from a DaemonSet?
  • What do you do if the API server static Pod fails to start?
  • How do managed services like EKS run the control plane instead?

Interview tips

  • Explain the bootstrap chicken-and-egg problem; it shows why static Pods exist.
  • Mention mirror Pods and that kubectl delete does not stop them.
  • Name the four control plane components kubeadm runs this way.

Concepts covered

Static Pods, Kubelet, Mirror Pods, staticPodPath, Control Plane Bootstrap

More Kubernetes & Orchestration questions