Hey guys, what's the use case of Static Pods in K8s?

cyberjames:
Hey guys, what’s the use case of Static Pods in K8s?

Shanmuga Raj:
controlplane

Trung Tran:
Mainly for the master node/controlplane component like apiserver, scheduler, etcd …

cyberjames:
So it’s like running those controlplane components in a worker node along with node components? But why?

Alistair Mackay:
In a kubeadm cluster, the controlplane node is a worker node, but it is usually tainted to prevent user workloads from running on it.
To create pods normally requires all the control plane components (API server, scheduler etc) to be running.
How do we create the API server pod without an API server?
Answer = Static Pod.
The kubelet creates static pods itself directly from the static pod manifest.

cyberjames:
Thanks @Alistair Mackay for your reply. Mumshad had covered that explanation already in the course at CKA. However, I still cannot picture out on what are the sample use case of having static pods in the worker node especially in the real world scenario.

Alistair Mackay:
In other nodes, there aren’t really any use cases. I see static pods as a workaround to make kubeadm clusters possible.

Trung Tran:
I got this from reddit:
“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. Although I didn’t go this route (I ended up using haproxy outside of kubernetes), it is a pretty nifty way to have it all in kubernetes. I would definitely do it this way when I finally get a pi cluster up and running”
@cyberjames, you can read this for reference purpose.

cyberjames:
Thanks again guys for your inputs!

unnivkn:
Hi @cyberjames fyr:
https://stackoverflow.com/questions/59612514/whats-the-difference-between-pods-and-static-pods-in-kubernetes-and-when-to