CKA — Static Pods

2 minute read

What Are Static Pods?

Static Pods are managed directly by the kubelet on a specific node, without the API server observing them. The kubelet watches a directory (typically /etc/kubernetes/manifests/) and automatically creates Pods for any manifest files found there.

All control plane components in a kubeadm cluster run as static Pods:

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

Static Pod vs Regular Pod

Aspect Static Pod Regular Pod
Created by kubelet (from manifest file) API server (from kubectl, controller)
Manifest location /etc/kubernetes/manifests/ etcd (via API server)
Visible in API Yes (as a mirror Pod, read-only) Yes (fully managed)
Can be deleted via kubectl No (kubelet recreates it) Yes
Scheduling Always on the node where manifest exists Scheduled by kube-scheduler
Naming <name>-<node-name> suffix Name as specified
Use case Control plane components Application workloads

The Manifests Directory

# Default static Pod manifest path
/etc/kubernetes/manifests/

# This path is configured in kubelet config
cat /var/lib/kubelet/config.yaml | grep staticPodPath
# Output: staticPodPath: /etc/kubernetes/manifests

# List control plane static Pods
ls /etc/kubernetes/manifests/
# etcd.yaml
# kube-apiserver.yaml
# kube-controller-manager.yaml
# kube-scheduler.yaml

Creating a Static Pod

To create a static Pod, place a manifest file in the static Pod directory:

# Create a static Pod manifest
sudo cat > /etc/kubernetes/manifests/static-web.yaml << EOF
apiVersion: v1
kind: Pod
metadata:
  name: static-web
  labels:
    role: static
spec:
  containers:
  - name: nginx
    image: nginx:1.27
    ports:
    - containerPort: 80
EOF

# The kubelet automatically detects and creates the Pod
# Check it (name will have the node suffix)
kubectl get pods -A | grep static-web
# static-web-<node-name>   1/1   Running   0   10s

Modifying a Static Pod

To modify a static Pod, edit the manifest file directly. The kubelet detects the change and recreates the Pod:

# Edit the manifest
sudo vim /etc/kubernetes/manifests/kube-apiserver.yaml

# The kubelet will automatically restart the Pod with new config
# Watch for it
kubectl get pods -n kube-system -w

Warning: Be very careful when editing control plane static Pod manifests. A syntax error can take down the API server, making kubectl unusable. Always verify YAML syntax before saving.

Deleting a Static Pod

# You CANNOT delete a static Pod via kubectl — kubelet will recreate it
kubectl delete pod static-web-<node-name>
# Pod gets recreated immediately

# To truly remove a static Pod, remove the manifest file
sudo rm /etc/kubernetes/manifests/static-web.yaml
# Now the Pod is gone permanently

Finding Static Pods

# Static Pods always have the node name as a suffix
kubectl get pods -A -o wide | grep -E "control|master"

# Check which Pods are static by looking for the mirror Pod annotation
kubectl get pod kube-apiserver-master -n kube-system -o yaml | grep -A2 annotations
# kubernetes.io/config.mirror: <hash>

Troubleshooting Static Pods

If a control plane component is not working:

# 1. Check if the manifest file exists and has valid YAML
sudo cat /etc/kubernetes/manifests/kube-apiserver.yaml | head

# 2. Check kubelet logs for errors
journalctl -u kubelet -f | grep -i error

# 3. Check container runtime for the container
crictl ps -a | grep kube-apiserver

# 4. Check container logs directly
crictl logs <container-id>

Exam tip: If the API server is down and kubectl does not work, use crictl and journalctl to troubleshoot. Check the manifest files for syntax errors and the kubelet logs for failure details.


Next: Cluster DNS →

Updated: