STATIC PODS

sonu kushwaha
2 min readJul 31, 2021

--

Have you Ever wondered , Can we launch Pods with out the aid of master node of Kubernets cluster .

answer is yes, we can launch our required pods directly on any of the worker node of our kubernets cluster and kubelet is the one that help running pods on that worker node

now let me explain you , how is the pod launched on worker node , what happens is when ever we use imperative or declarative way to lunch pod with the aid of master node , the master node sends that request to API server on master node then API server forwards it to Scheduler and what scheduler does is schedule’s on which worker node to launch and then the descision made passed to kubelet via api server , and pods are launched .

so , this makes us clear that kubelet is the one that helps in launching pods. Now lets launch pod with kubelet in worker node and the pod diretly launched on worker node is termed as static pod.

Since the static pods are not launched with the aid of master if one try to delete the static pod via master node does not have any control over that pod ie if one try to delete static pod via master , it will spinn up automatically again on its own .the only way to delete satic pod is by removing the yaml for worker node it self.

Steps for creating ‘’STATIC PODS’’

  • Go to worker node then check for all the process running on that node with the name kubelet

”ps -aux |grep kubelet”

above command will give the location of the configurarion file of the kubelet ie config.yaml file .

and the config.yaml file consist of the path of the static pod manifest ,ie

/etc/kubernetes/manifest/

now in the above path start writting the yaml file , of pods and once you will save the file ,the resources(pods) will be lunched automatically.

The real use case for static pods in kubernetes

  • One real case I’ve encountered at work is deploying a load balancer for the control plane. Because on-prem solutions don’t really have a native load balancer like cloud platforms, to have a control plane endpoint that features high availability, you either need to create it completely outside of kubernetes or inside. But because you can’t really run it in kubernetes without kubernetes, you run into a chicken and egg situation. That’s where static pods come into play. For vanilla kubernetes (like kubeadm), kubeadm creates the necessary control plane components via static pods, and during that process, you can create your own static pods (like load balancer pods) one such solution is haproxy.

--

--

sonu kushwaha
sonu kushwaha

Written by sonu kushwaha

open source enthusiast Docker, kubernetes

No responses yet