As a part of my PhD thesis, I am considering to use Kubernetes as a testing platform for trying out a scheduling algorithm. This would require writing an extension to Kubernetes in the form of a scheduler. What gets me confused about Kubernetes is the matter of a pod lifecycle.
I understand that a pod goes through scheduling process before it gets deployed and started. What I don't understand is what happens when (1) we kill an instance of a pod and run a new one, similar to the one we killed, or (2) the physical node itself becomes unable to run our pod, (3) or the instance of the pod crushes?
In particular, I am trying to prove or disprove my suspicion that in such cases Kubernetes creates new instances of the pod and pushes them through the same pipeline as it would do during startup, which would guarantee that my yet to be implemented custom scheduler is triggered. That no shortcuts that would skip scheduling process are used here.
A ref. to a relevant spec. would be of a great appreciation.
Thanks a lot in advance!
CodePudding user response:
(1) ... run a new one, similar to the one we killed
A new pod will be scheduled to a node by a scheduler (you can have a custom scheduler).
(2) the physical node itself becomes unable to run our pod
If the pod is managed (e.g. created by a Deployment), a new pod will be created and scheduled to another node, eventually. But if the pod is just a stand-alone pod, it is just terminated.
(3) or the instance of the pod crashes?
Same as for (2)
above, if the instance crashes.
If just the Pod crashes, it will be restarted on the same node (not re-scheduled).