Skip to content

Static Pods

What Are Static Pods?

Static Pods are pods managed directly by the kubelet on each node, not through the Kubernetes API server. They are especially useful for critical components like the control plane (e.g., etcd, kube-apiserver).

Key Characteristics:

  • Created and managed by the kubelet
  • Not stored in etcd
  • No controller (like ReplicaSet or DaemonSet)
  • YAML files reside on disk, typically at /etc/kubernetes/manifests/
  • Automatically recreated if deleted

Static Pod Overview


Configuring Static Pod Path

The kubelet watches a specific directory for static pod manifests. This path can be defined in two ways:

1. Via kubelet startup args (older method):

--pod-manifest-path=/etc/kubernetes/manifests

2. Via config file:

# /var/lib/kubelet/config.yaml
staticPodPath: /etc/kubernetes/manifests

Kubelet Service Definition


Container Runtime Tools

Use the appropriate tool depending on your runtime:

  • CRI-O: crictl ps
  • containerd: nerdctl ps
  • docker: docker ps

Runtime Tools


Relationship to Master Components

Static pods are commonly used to deploy the Kubernetes control plane components:

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

They appear in the cluster as normal pods, but are actually directly managed by the kubelet.

Control Plane via Static Pods


Real-World Use Case: Multi-master Setup

Each control plane node has its own static pod manifest for the control plane components:

/etc/kubernetes/manifests/
  - apiserver.yaml
  - controller-manager.yaml
  - etcd.yaml

Multiple Masters

To view them:

kubectl get pods -n kube-system

How Many Static Pods Exist?

Check Manifest Files:

ls /etc/kubernetes/manifests/

Each file corresponds to a static pod. Example:

etcd.yaml
kube-apiserver.yaml
kube-controller-manager.yaml
kube-scheduler.yaml

Count Static Pods via kubectl:

kubectl get pods --all-namespaces -o jsonpath='{range .items[?(@.metadata.ownerReferences==null)]}{.metadata.name}{"\n"}{end}' | wc -l

Ensure to wrap JSONPath in single quotes to avoid shell interpretation errors.


Identifying Static vs Non-static

Example: Check if a Pod is Static

kubectl get pod kube-apiserver-controlplane -n kube-system -o jsonpath='{.metadata.ownerReferences}'
  • Empty output or "kind": "Node" -> Static Pod
  • Output like "kind": "ReplicaSet" -> Managed Pod

Pod Listing


Static Pods vs DaemonSets

Static Pods DaemonSets
Created by kubelet Created by Kube-API Server
No controller Managed by DaemonSet controller
Used for core control plane Used for node-wide services like logging, monitoring
Ignored by kube-scheduler Scheduled by controller automatically

Comparison


Bonus Commands

Check image used by a static pod:

cat /etc/kubernetes/manifests/kube-apiserver.yaml | grep image

Create a static pod:

sudo tee /etc/kubernetes/manifests/static-busybox.yaml > /dev/null <<EOF
apiVersion: v1
kind: Pod
metadata:
  name: static-busybox
  namespace: default
spec:
  containers:
  - name: busybox
    image: busybox:1.28.4
    command: ["sleep", "1000"]
EOF

Delete a static pod:

Delete the manifest file:

sudo rm /etc/kubernetes/manifests/static-busybox.yaml

Summary

  • Static Pods are node-local and managed by the kubelet
  • They are used for critical components like etcd and kube-apiserver
  • Easily detectable via missing ownerReferences
  • Defined on disk and automatically watched by kubelet