Scheduling of resources in k8s and Static Pods
Whenever a new manifest file is applied through kubectl it first goes to the K8s API server in then control plane, then etcd does the checks about resources and on the available information, scheduler is notified to create the resource. Now in this case if it is not defined that in which node the resource to be created Scheduler does this by performing its own checks on available computing resources like memory and all.
Now if we predefine that in which node the resource to be created then kubelet automatically create the resource bypassing the scheduler. Now if scheduler is responisible for creating the resources then who creates scheduler pod, and the other control plane components. These are called static pods. In every Kubernetes cluster in this
/etc/kubernetes/manifests/path if you move any k8s manifests kubelet creates the resource as it always watches this directory and kubelet itself is not a Pod at all (at least not initially). It’s a system-level process (a binary) that runs directly on each node’s operating system. You can check with
systemctl status kubeletcommand.
Now if you put any resource manifest in /etc/kubernetes/manifests/ directory then static pods will be created, If don't specify about the node location of that resource scheduler will automatically create that in some node. If you want to create in your desired node then
nodeSelector:
kubernetes.io/hostname: NODE_NAMEput this in the end of your yaml, and now kubelet will create that resource bypassing the scheduler.