- Take me to Video Tutorial
In this section, we will take a look at Static Pods
- You can configure the kubelet to read the pod defination files from a directory on the server designated to store information about pods.
- Place the pod defination files in this directory (/etc/kubernetes/manifests), the kubelet periodically checks this directory for files, reads these files and create pods on the host.
- Not only does it create the pod it can ensure that the pod stays alive.
- If the application crashes, the kubelet attempts to restart it.
- If you make a change to any of the file within this directory, the kubelet recreates the pod for those changes to take effect.
- If you remove a file from this directory the pod is deleted automatically.
- You cannot create replicasets or deployments or services by placing a defination file in the designated directory.
-
The designated directory can be any directory on the host and the location of that directory is passed in to the kubelet as an option while running the service.
- The option is named as
--pod-manifest-path.
- The option is named as
-
Instead of specifying the option directly in the
kubelet.servicefile, you could provide a path to another config file using the config option, and define the directoy path as staticPodPath in the file.
The kubelet can create both kinds of pods - the static pods and the ones from the api server at the same time.
-
Static pods can be listed as any other pod.
-
when the kubelet creates a static pod, if it is a part of a cluster, it also creates a mirror object in the kube-apiserver.
-
You can view the details of the pod but you cannot delete or edit it like the usual pods. You can only delete them by modifying the files from the nodes manifest folder.