<p>I am trying to run a Kubernetes job that will deploy the same pod on each host and run the same command in each of the pods (identical execution). There are 5 workers in the cluster <code>worker01</code>, <code>worker02</code>, ..., <code>worker05</code>. This definition schedules one pod on a random host:</p>
<pre class="lang-yaml prettyprint-override"><code>apiVersion: batch/v1
kind: Job
metadata:
  name: hdd-integrity
  labels:
    job: hdd-integrity
spec:
  template:
    spec:
      containers:
        - name: hdd-integrity
          image: some-image
          imagePullPolicy: IfNotPresent
          command: [&quot;python&quot;, &quot;check.py&quot;]
          args:
            - &quot;--threads=88&quot;
            - &quot;--md5=2a3f98b6eb50326cf69257c5c5fc7e35&quot;
            - &quot;--dir=/mnt&quot;
          volumeMounts:
            - name: store
              mountPath: /mnt
      restartPolicy: Never
      volumes:
        - name: store
          persistentVolumeClaim:
            claimName: subgrp1-subvol1-pvc
            readOnly: false
  backoffLimit: 1
</code></pre>
<p>All pods should mount to the same pvc. Not sure what is the best way to achieve this. Daemonsets will not work because they do not provide <code>restartPolicy: Never</code></p>

John Karasev
<p>If you want to schedule a pod per node for a specific application, the right way to do so in the Kubernetes is using the <a href="https://kubernetes.io/docs/concepts/workloads/controllers/daemonset/" rel="nofollow noreferrer">Daemonset</a>.</p>
<blockquote>
<p>A DaemonSet ensures that all (or some) Nodes run a copy of a Pod. As
nodes are added to the cluster, Pods are added to them. As nodes are
removed from the cluster, those Pods are garbage collected. Deleting a
DaemonSet will clean up the Pods it created.</p>
</blockquote>
<p>Further, if you want to schedule each pod in a different node, you can look at <a href="https://kubernetes.io/docs/concepts/scheduling-eviction/assign-pod-node/#inter-pod-affinity-and-anti-affinity" rel="nofollow noreferrer">pod anti-affinity</a> concepts.</p>
