0
0
KubernetesConceptBeginner · 3 min read

What is Static Pod in Kubernetes: Simple Explanation and Example

A 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.

yaml
apiVersion: v1
kind: Pod
metadata:
  name: static-nginx
  namespace: kube-system
spec:
  containers:
  - name: nginx
    image: nginx:1.23
    ports:
    - containerPort: 80
Output
The kubelet on the node reads this file and starts a pod named 'static-nginx' running the nginx container on port 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-system namespace.

Key Takeaways

Static pods run directly on a node via kubelet using local config files, bypassing the API server.
They are ideal for essential system services that must run even if the cluster control plane is down.
Static pods cannot be scheduled or moved by Kubernetes and are tied to one node.
They appear in Kubernetes only after kubelet reports them, usually in the kube-system namespace.
Use static pods for critical node-level components like network proxies or monitoring agents.