Skip to content

Latest commit

 

History

History
executable file
·
80 lines (51 loc) · 2.44 KB

File metadata and controls

executable file
·
80 lines (51 loc) · 2.44 KB

Static Pods

What are Static Pods

Static pods are pods that are managed directly by the nodes kubelet and not through the Kubernetes' API server. This means that static pods are not scheduled by the Kubernetes scheduler and instead are always scheduled onto the node by the kubelet.

Static Pod Manifests

A Static Pod Manifest describes the configuration of a Pod. These are generated by the kubeadm init for the cluster components that it needs to bootsrap:

  • etcd
  • API server
  • Controller anager
  • Scheduler

The kubelet then monitors the manifests directory and starts up Pods that are described in those manifests.

This enables the core cluster components to start without the cluster

These static pod manifests are stored in the directory below, but the kubelet can be configured to use any directory.

/etc/kubernetes/manifests

The kubelet periodically checks this directory and creates the Pods based on the resource definitions on the file. If changes are made on the files inside this directory, the kubelet recreates the Pod for the changes to take effect.

If a file is removed, then the Pod associated with that file is also deleted.

Setting a Directory for the Static Pod Manifests

To set a different directory, edit the kubelet.service and specify the pod-manifest-path in the ExecStart:

# /etc/systemd/system/kubelet.service
.....

ExecStart=/usr/bin/kubelet \
    --kubeconfig=/var/lib/kubelet/kubeconfig 
    --network-plugin=cni \
    --register-node-true \
    --container-runtime=re \
    --container-runtime-endpoint=unix:///var/run/containerd/containerd.sock \
    --pod-manifest-path=/etc/kubernetes/manifests

Another way to specify the Pod directory is by adding a kubeconfig.yaml and then specifying the staticPodPath in that YAML file.

# /etc/systemd/system/kubelet.service
.....

ExecStart=/usr/bin/kubelet \
    --kubeconfig=/var/lib/kubelet/kubeconfig 
    --network-plugin=cni \
    --register-node-true \
    --container-runtime=re \
    --container-runtime-endpoint=unix:///var/run/containerd/containerd.sock \
    --config=kubeconfig.yaml
# kubeconfig.yaml
    
staticPodPath: /etc/kubernetes/manifests

Back to first page