TIL - You do not need Kubernetes API Server to spin up Pods
Yes, you heard it correctly! When I read about it, it blew my mind. 🤯
In Kubernetes, the control plane manages the Pods. To run a Pod with an Nginx container, we run the following command -
> kubectl run nginx --image nginx
Kubernetes will make sure that a Pod with the "nginx" name is spun-up and uses the "nginx:latest" image. But let me tell you that there are other ways to run Pods in Kubernetes. These Pods are called Static Pods.
Static Pods are managed directly by the kubelet daemon running on a specific node, without requiring an API server to observe or manage them. Unlike Pods managed by the control plane, kubelet manages Static Pods. In a way, Static Pods are always bound to one kubelet running on a specific node in the cluster.
The below example uses minikube to demonstrate how Static Pods work. Kubernetes clusters instantiated using minikube use the path /etc/kubernetes/manifests
to store the pre-configured manifest files of etcd, api-server, controller-manager, and scheduler. The kubelet daemon running on this node constantly watches for any changes in this directory. When I save the nginx.yaml
file, the kubelet picks up the nginx.yaml
Pod manifest file and deploys it instantly.
Kubernetes documentation below mentions other ways to deploy Static Pods -