Question - How to write a Kubernetes scheduler?
Answer -
The kube-scheduler is the default scheduler for Kubernetes. It is designed such that if you prefer, you can write your own one and use that instead.
Following is the syntax:
kube-scheduler [flags]
The scheduling life cycle:
- A pod is created and the preferred state is mentioned, and without filling the node name, it is saved to etcd
- The scheduler notices the new pod with no node bound
- It finds a suitable node for that pod
- It then informs the API server to bind the pod to the node, and next, the new desired state is saved to etcd
- Kubelets watch the pods that are bound and start the containers on the particular node