This is more of cost estimation question than how to use features like node affinity.
So basically there are m
pods with some constraints like:
Deployments
/ StatefulSets
should be on a different kubernetes nodeDeployments
/ StatefulSets
should be balanced over 3 availability zonesNow, I want to find how many nodes (all same types) I will need to host given set of Deployments
/ StatefulSets
.
I first thought this of more like an assignment problem to be solved using Hungarian Algorithim but this seems much more complex in term like multi dimensional constraints.
By my knowledge the algorithm used by default by the kube-scheduler is described on github here.
It explains how it works. It first filters nodes that do not meet the requirements of the pods, e.g. resource requests > available resources on nodes, affinity etc.
Then uses a ranking algorithm to determine the best fitting node. For deeper insights on the