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 worker01
, worker02
, ..., worker05
. This definition schedules one pod on a random host:
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: ["python", "check.py"]
args:
- "--threads=88"
- "--md5=2a3f98b6eb50326cf69257c5c5fc7e35"
- "--dir=/mnt"
volumeMounts:
- name: store
mountPath: /mnt
restartPolicy: Never
volumes:
- name: store
persistentVolumeClaim:
claimName: subgrp1-subvol1-pvc
readOnly: false
backoffLimit: 1
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 restartPolicy: Never