liveBook · Manning

Scheduler

As explained in Kubernetes in Action, Second Edition

The Kubernetes scheduler is the control-plane component that selects a worker node for each unscheduled application instance.

The Kubernetes scheduler decides which worker node should run each new Pod. It belongs to the control plane, which directs the cluster; applications run on worker nodes instead. Here, scheduling means assigning a Pod to a node, not arranging for it to run later. section 1.2.3 section 3.3.1

When you submit an application manifest, the API server stores its objects. A controller creates an object for each application instance, and the scheduler assigns each instance a node. The Kubelet on that node then starts it through the container runtime. The scheduler chooses where it runs; the Kubelet does the running. section 1.2.4

From Deployment to running container

Running `kubectl create deployment kiada --image=luksa/kiada:0.1` creates a Deployment. Kubernetes creates a Pod and assigns it to a worker node. The node’s Kubelet then pulls the image, creates the container, and starts it. Once assigned, that Pod instance stays on its node; if it fails, a new Pod instance may replace it rather than move it. section 3.3.1

Type    Reason     Age   From                    Message
----    ------     ----  ----                    -------
Normal  Scheduled  25s   default-scheduler       Successfully assigned 
                                                 default/kiada-9d785b578-p449x 
                                                 to kind-worker2
Normal  Pulling    23s   kubelet, kind-worker2   Pulling image "luksa/kiada:0.1"
Normal  Pulled     21s   kubelet, kind-worker2   Successfully pulled image 
Normal  Created    21s   kubelet, kind-worker2   Created container kiada
Normal  Started    21s   kubelet, kind-worker2   Started container kiada

The event listing makes the handoff visible: `Scheduled` names the chosen node, followed by Kubelet events for pulling the image, creating the container, and starting it. section 3.3.1

How Kubernetes in Action, Second Edition covers it

How deep it goes
Defines scheduling and traces its place in deployment, without explaining how the scheduler chooses among nodes.
Examples
Follows a kubectl-created Deployment through Pod assignment and Scheduled, Pulling, Created, and Started events.
What it assumes
Introduces scheduling with a definition and explains its role using a basic Deployment example.
What you can do after
Diagnose/debug with it by distinguishing a Pod’s node assignment from the Kubelet’s subsequent container startup.
How it connects
Connects scheduling to the control plane, controllers, Pods, worker nodes, and Kubelet.

Also explained in

Compare how 12 books explain scheduler →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Kubernetes in Action, Second Edition. The section links point to the parts of the book it draws on.