<p>Batch computations, Monte Carlo, using Docker image, multiple jobs running on Google cloud and managed by Kubernetes. No Replication Controllers, just multiple pods with NoRestart policy delivering computed payloads to our server. So far so good. Problem is, I have cluster with <code>N</code> nodes/minions, and have <code>M</code> jobs to compute, where <code>M &gt; N</code>. So I would like to fire <code>M</code> pods at once and tell Kubernetes to schedule it in such a way so that only <code>N</code> are running at a given time, and everything else is kept in Pending state. As soon as one pod is done, next is scheduled to run moving from Pending to Running and so on and so forth till all <code>M</code> pods are done.</p>

<p>Is it possible to do so? </p>

<p>Just for the record, after discussion with Alex, trial and error and a binary search for a good number, what worked for me was setting the CPU resource limit in the Pod JSON to:</p>

<pre><code>    "resources": {
        "limits": {
            "cpu": "490m"
        }
    }
</code></pre>

<p>I have no idea how and why this particular value influences the Kubernetes scheduler, but it keeps nodes churning through the jobs, with exactly one pod per node running at any given moment.</p>
