The Conductor of Kubernetes: The kube-scheduler
Explore the role of the kube-scheduler in Kubernetes architecture. Understand how it assigns Pods to the best nodes based on labels, taints, affinity rules, resource availability, and priority, ensuring balanced and efficient scheduling across the cluster.
We'll cover the following...
The kube-scheduler
The kube-scheduler is a core component that helps assign Pod objects to the best node for them to run on with multiple scheduling strategies. It runs on the control plane, together with the kube-apiserver and kube-controller-manager. In this lesson, we present a brief introduction to the kube-scheduler.
What does the kube-scheduler do?
Generally speaking, the operation of kube-scheduler looks quite simple. All it does is wait for newly created Pod objects by watching the kube-apiserver and assigning a best-fitted node to those new Pod objects (also called “unassigned pods”) that don’t have a node assigned yet.
While the kube-scheduler neither manages the Pod directly nor operates the selected node to run the Pod, it updates the pod specification to the kube-apiserver. Then, the kube-apiserver will notify the kubelet running on the target node that the Pod has been scheduled.
The graph below shows the coarse-grained view of the scheduling process.
On the startup of the kube-scheduler, it will send out a WATCH request on unassigned Pod objects to the kube-apiserver. Once a new Pod is created, the kube-scheduler will be notified. Inside of the kube-schduler, there’s a queue to store all the unassigned pods, which will be scheduled one by one. The scheduling task to select a node that best fits the Pod isn’t that simple. We aren’t picking up a random node ...