In the last article we studied about Daemon Sets. Now let us know what are static pods.
We have been deploying pods since quite a long time now. Now let us assume that there is a worker node or a server which is not apart of any cluster. Now the point to think about is : Can this server with only kubelet and container runtime environment installed , host a pod ?
In other words is there any way to create a pod on the worker node without the kube-API server ? The answer is YES and this type of pod is known as a static pod.
Any such kind of pod can be written in a manifest file on the path /etc/kubernetes/manifests/
The kubelet keeps checking this path regularly, provisions the pod and makes sure that it is up and running always.
Any changes made inside this directory is being read by kubelet and appropriate action is taken. Note that these kind of pods are known as static pods. We can create only pods using this approach and no services or deployments can be created.
Static pod status can be viewed by using docker ps command . kubectl command will not work here. Why ? Because this node is not a part of cluster and kubeadm works only with kube-api server.
Next question is the master node aware about the pod created statically ? yes it is . if the node joins the cluster later point of time, it automatically creates a read only copy of of the pod that is being communicated to master node.
Use Case for static pods
As we know static pods are not dependent on master node components .Static pods can be used to deploy those components itself.
[root@node1 manifests]# pwd /etc/kubernetes/manifests [root@node1 manifests]# ll total 16 -rw------- 1 root root 1866 Jun 10 22:16 etcd.yaml -rw------- 1 root root 2706 Jun 10 22:16 kube-apiserver.yaml -rw------- 1 root root 2565 Jun 10 22:16 kube-controller-manager.yaml -rw------- 1 root root 1120 Jun 10 22:16 kube-scheduler.yaml
Alright people.We have come a long way but still a long way to go :-)
In the next article we are going to study about logging and monitoring in kubernetes.