<p>This is more of cost estimation question than how to use features like node affinity.</p>
<p>So basically there are <code>m</code> pods with some constraints like:</p>
<ul>
<li>each pod of specific <code>Deployments</code> / <code>StatefulSets</code> should be on a different kubernetes node</li>
<li>pods of specific <code>Deployments</code> / <code>StatefulSets</code> should be balanced over 3 availability zones</li>
</ul>
<p>Now, I want to find how many nodes (all same types) I will need to host given set of <code>Deployments</code> / <code>StatefulSets</code>.</p>
<p>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.</p>

codersofthedark
<p>By my knowledge the algorithm used by default by the kube-scheduler is described on github <a href="https://github.com/open-policy-agent/opa-kube-scheduler/blob/master/vendor/k8s.io/kubernetes/docs/devel/scheduler_algorithm.md" rel="nofollow noreferrer">here</a>.</p>
<p>It explains how it works. It first filters nodes that do not meet the requirements of the pods, e.g. resource requests &gt; available resources on nodes, affinity etc.</p>
<p>Then uses a ranking algorithm to determine the best fitting node. For deeper insights on the</p>
