What is Static Pod in Kubernetes: Simple Explanation and Example
static pod in Kubernetes is a pod managed directly by the kubelet on a node, not through the Kubernetes API server. It runs based on a pod configuration file on the node, making it useful for critical system components that must run independently of the cluster control plane.How It Works
A static pod is like a special task that a worker (the kubelet) on a single machine runs by itself, without asking the main manager (the Kubernetes API server) for permission. Instead of the usual way where the manager tells the worker what to do, the worker looks at a file on its own disk that describes the pod it should run.
This means the pod is tied directly to that node and is not visible in the usual Kubernetes pod list unless the kubelet reports it. It’s like having a personal to-do list taped to your desk that you follow without checking with your boss.
Static pods are often used for important system parts like the node’s network or storage agents, which need to start even if the main Kubernetes system is down.
Example
This example shows a simple static pod configuration file placed on a node. The kubelet will read this file and start the pod automatically.
apiVersion: v1 kind: Pod metadata: name: static-nginx namespace: kube-system spec: containers: - name: nginx image: nginx:1.23 ports: - containerPort: 80
When to Use
Use static pods when you need a pod to run on a node no matter what, even if the Kubernetes control plane is down or unreachable. They are perfect for running essential system services like network proxies, monitoring agents, or storage daemons that must start before the cluster is fully operational.
For example, if you want to run a critical logging agent on every node that helps diagnose problems early, a static pod ensures it runs independently of the cluster state.
Key Points
- Static pods are managed directly by the kubelet on a node, not by the Kubernetes API server.
- They are defined by pod configuration files stored on the node's filesystem.
- Static pods are tied to a specific node and cannot be scheduled or moved by Kubernetes.
- They are useful for critical system components that must run independently of cluster control.
- Static pods appear in the Kubernetes API only after the kubelet reports them, usually under the
kube-systemnamespace.