Static Pods in Kubernetes: What, Why, and How
In Kubernetes, most pods are managed by the control plane through controllers like Deployments or DaemonSets. However, there’s a special kind of pod called a static pod. These are managed directly by the kubelet on each node, bypassing the Kubernetes API server.
Why Use Static Pods?
Static pods are useful when:
- You want to ensure critical system components (like logging or monitoring agents) are always running.
- You don’t want to rely on the control plane to schedule pods.
- You’re bootstrapping a Kubernetes cluster and need kubelet to run etcd or control-plane components before the API server is available.
Key Characteristics
- Managed only by the
kubelet
. - Not visible via
kubectl get pods
unless mirrored by the API server. - Defined using simple YAML files placed in a designated directory.
How to Create a Static Pod
1. Enable Static Pod Path on Kubelet
Make sure the --pod-manifest-path
is set in your kubelet config or systemd service file:
--pod-manifest-path=/etc/kubernetes/manifests
Restart kubelet after updating the config.
2. Create a Pod Manifest
Here’s an example nginx-static.yaml
:
apiVersion: v1
kind: Pod
metadata:
name: nginx-static
spec:
containers:
- name: nginx
image: nginx:latest
ports:
- containerPort: 80
Save this file to the /etc/kubernetes/manifests
directory. Kubelet will automatically detect and start it.
3. Check Status
crictl ps -a
To view logs:
crictl logs <container-id>
If mirrored to API server:
kubectl get pods -A | grep nginx-static
Limitations
- No labels/selectors, so can’t use Services or Deployments.
- Not managed by the API server – no lifecycle hooks or rolling updates.
- Node-specific and hard to manage at scale.
Use Cases
- Bootstrapping etcd or control-plane components.
- Ensuring monitoring/agent tools start with the node.
- Bare-metal setups with minimal control plane reliance.
Conclusion
Static pods are a powerful but niche feature in Kubernetes. They provide reliability and low-level control at the node level, ideal for critical system pods and bootstrap scenarios.