Skip to content

2.09 Static Pods

Static Pods are pods managed directly by the kubelet, independent of the kube-apiserver or other control plane components.

Key Concept

  • Normally, the kubelet relies on the kube-apiserver and scheduler for instructions.
  • However, even without these components (no master, etcd, or controllers), the kubelet can operate independently by creating pods from manifest files placed in a designated directory on the node.

How It Works

  • The kubelet periodically checks a configured Pod Manifest Path (e.g., /etc/kubernetes/manifests) for pod definition files.
  • When a file is added β†’ the kubelet creates the pod.
  • When the file is updated β†’ the kubelet recreates the pod.
  • When the file is removed β†’ the pod is automatically deleted.
  • The kubelet ensures the pod stays running and restarts it if it crashes.

Configuration Options

You can configure the static pod path in two ways:

  1. Directly in the kubelet service:

    --pod-manifest-path=/etc/kubernetes/manifests
    
    static-pods-2

  2. Through the Kubelet Config File:

    staticPodPath: /etc/kubernetes/manifests
    
    The kubelet continuously monitors this directory and manages any pod definitions within it. static-pods


Commands

  • When working outside a cluster (no API server), view static pods using CRI commands:

      docker ps 
    

  • When the node is part of a cluster, view static pods as mirror pods in the API server:

    kubectl get pods
    

  • Static pods appear as read-only mirror pods in the API server.

  • Their names are automatically appended with the node name, static-pods-3

πŸ”Ή Kubelet and Static Pod Interaction

The kubelet can receive instructions to create pods from two different sources:

  • From pod definition files located in the static pod directory.
  • From HTTP API requests sent by the kube-apiserver.

  • This allows the kubelet to manage both static pods and regular pods at the same time.

  • When a node running the kubelet is part of a cluster, the API server becomes aware of the static pods it creates.

  • The kubelet automatically generates a mirror object for each static pod within the API server.

  • These mirror pods appear like regular pods in the cluster, but they are read-only representations.

  • You can view their details, but you cannot edit or delete them through the API server.
  • To modify or remove a static pod, you must update or delete its manifest file from the node’s designated manifest directory.

πŸ”Ή Use Case

Static Pods are ideal for deploying control plane components, such as:

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

static-pods-control-plane

  • They restart automatically if they crash, making them reliable for bootstrapping clusters.
  • This is exactly how kubeadm sets up the control plane β€” by running its core components as static pods stored under /etc/kubernetes/manifests.

πŸ”Ή Static Pods vs DaemonSets

Static Pods DaemonSets
Created by the kubelet Created by the kube-apiserver (DaemonSet Controller)
Deploy Control Plane components as static pods Deploy Monitoring Agents or Logging Agents on all nodes
Ignored by the kube-scheduler Ignored by the kube-scheduler