Running Static Pods in Kubernetes

This article covers how we can run Static Pods in Kubernetes. Static pods are regular pods, however their deployment yaml can be stored anywhere based on your requirement. Static pods are configured to be start at Kubelet daemon or whenever Kubelet daemon reloads itself. All Master components run as Static pod and configured to be run at start/reload of Kubelet daemon.

Yaml files for master’s major components are located at /etc/kubernetes/manifests directory.

On Master node, kubelet reads the kubeadm configuration file stored under /etc/systemd/system/kubelet.service.d/ and from 10-kubeadm.conf file, it furthers read the configuration required to start Kubelet service on master node and what parameters need to be passed. In Kubelet configuration file, we can see parameter “staticPodPath” has been passed with value set to “/etc/kubernetes/manifests” from where it reads deployment configuration required to start major components of Master.

Apart from this, you can also create a custom directory which you might have created for certain services that needs to be up all the time, then below option can be used for ExecStart arguments.

ExecStart=/usr/bin/kubelet $KUBELET_KUBECONFIG_ARGS $KUBELET_CONFIG_ARGS $KUBELET_KUBEADM_ARGS $KUBELET_EXTRA_ARGS \

— pod-manifest-path=/path/to/deployment(Double hyphen symbol before pod-manifest-path option).

Once this file is edited, you need to reload Kubelet daemon and with “docker ps -a” output, you can see the Static Pod you created. This can also be seen in “kubectl get pods” output from Master.

Thus using Kubelet daemon service, Master is able to keep up all the necessary pods at all the time. Keep reading, keep learning. :)