<p>What's the easiest way to run a configurable number of identical jobs on Kubernetes but give each of them different parameters (like job number)?</p>

<ol>
<li>You could either just have a template job and use bash expansions to have multiple job specifications based of that initial template.</li>
</ol>
<p>As shown in the official <a href="https://kubernetes.io/docs/tasks/job/parallel-processing-expansion/" rel="nofollow noreferrer">Parallel Processing using Expansions</a> user guide:</p>
<pre><code>mkdir ./jobs
for i in apple banana cherry
do
  cat job.yaml.txt | sed &quot;s/\$ITEM/$i/&quot; &gt; ./jobs/job-$i.yaml
done
kubectl create -f ./jobs
</code></pre>
<hr />
<ol start="2">
<li>Or you could create a queue and have a specified number of parallel workers/jobs to empty the queue. The contents of the queue would then be the input for each worker and Kubernetes could spawn parallel jobs. That's best described in the <a href="https://kubernetes.io/docs/tasks/job/coarse-parallel-processing-work-queue/" rel="nofollow noreferrer">Coarse Parallel Processing using a Work Queue</a> user guide.</li>
</ol>
<hr />
<ul>
<li>The first approach is simple and straight forward but lacks flexibility</li>
<li>The second requires a message queue as &quot;overhead&quot; but you'll gain flexibility</li>
</ul>
