Kubernetes 101 : Static pods and the Kubelet
We can use the kubelet to start pods - called static pods -, delete them and restart them when they crash.
We could do that by placing the configuration Yaml files of the pods in a reserved directory on the host - "/etc/kubernetes/manifests" -.
We could configure the kubelet to go through that folder, and create the pods according to the Yaml files there.
If we delete a pod's Yaml file, the kubelet will delete the pod related to it.
The kubelet regularly checks the "/etc/kubernetes/manifests" folder, and create the pods corresponding to the Yaml files there, or deletes the pods whose Yaml files have been deleted.
If we make a modification to a Yaml file of a pod, the kubelet recreates the new pod with the changes.
The kubelet service:
When we start a kubelet as a service, we can pass to it as a parameter the directory of the manifest folder "/etc/kubernetes/manifests" as we can see below:
Usually we have this and other parameters in the below file: "/etc/systemd/system/kubelet.service.d/10-kubeadm.conf"
The kube-apiserver is aware of the static pods, since it can display them when we run the below command:
The naming convention for the static pods is a below:
We could use the static pods to run kubernetes processes, like the kube-api server, the etcd server , ...