How to Create and Manage Static Pods on Node in Kubernets

A Static Pod is a pod that is directly managed by the kubelet (node agent) instead of the Kubernetes API server. It is managed locally by kubelet by creating YAML file directly on the Node by connecting node and create static pod with yaml file directly by using Kubectl apply command.

👉 Normal pods:

  • Created using kubectl apply
  • Managed by API server, scheduler, etc.

👉 Static pods:

  • Created by placing a YAML file on the node
  • Managed locally by kubelet only
  • No scheduler, no controller

Where Static Pods are Used (Real Example)

In most Kubernetes clusters (especially kubeadm):

Control plane components run as static pods:

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

These YAML files are usually stored here:

/etc/kubernetes/manifests/

How Static Pods Work (Flow)

  1. kubelet watches a directory: /etc/kubernetes/manifests/
  2. You place a YAML file there
  3. kubelet:
    • Reads the file
    • Creates the pod
    • Ensures it is always running
  4. If the file is deleted → pod is deleted

Example Static Pod YAML

First connect with the Node directly then Create file on node:

As seen in standard pod definitions, YAML requires fields like apiVersion, kind, metadata, and spec

/etc/kubernetes/manifests/nginx-static-pod.yaml
apiVersion: v1
kind: Pod
metadata:
name: nginx-static
labels:
app: nginx
spec:
containers:
- name: nginx
image: nginx
ports:
- containerPort: 80

How to Verify Static Pod

Even though it’s not API-controlled, you will still see it:

kubectl get pods -o wide

mportant Behavior

1. Restart behavior

  • kubelet restarts static pod automatically if it crashes

2. No Deployment support

  • You cannot scale it like
kubectl scale deployment

3. Mirror Pod (important concept)

  • Kubernetes creates a mirror pod in API server
  • That’s why kubectl get pods shows it

Static Pod vs Normal Pod (Quick Comparison)

FeatureStatic PodNormal Pod
Created fromLocal filekubectl/API
Scheduled❌ No✅ Yes
Managed bykubeletAPI + controllers
Scaling❌ No✅ Yes
Use caseSystem-levelApplication workloads