How scheduler talks to API server?

6/19/2019

I would like to know, in which parts of the codes in kubernetes ( https://github.com/kubernetes/kubernetes) the scheduler talks to the API server and then the API server sends out the scheduling information to kubelet?

-- HamiBU
kubernetes

1 Answer

6/20/2019

Scheduler register a informer to specify resource(e.g. pod, PV...), register some callback function to event(e.g. add, delete, update...), these code at: https://github.com/kubernetes/kubernetes/blob/master/pkg/scheduler/eventhandlers.go#L319.

Then event callback will put pod spec in the queue, scheduler will check the queue, add use some algorithm to schedule the pod to some node. Finally, scheduler will update the pod information to apiserver.

Kubelet will check the apiserver to find which pod need update, then create the container, bind the volume...

p.s. It is complex to understand the whole lifecycle about how kubernetes works, please provide what you want to know exactly.

-- menya
Source: StackOverflow