apiVersion: batch/v1 kind: CronJob metadata: name: previewgenerator-cron labels: app.kubernetes.io/name: nextcloud app.kubernetes.io/component: previewgenerator spec: schedule: "3,13,23,33,43,53 * * * *" concurrencyPolicy: Forbid successfulJobsHistoryLimit: 1 failedJobsHistoryLimit: 1 jobTemplate: metadata: labels: app.kubernetes.io/name: nextcloud app.kubernetes.io/component: previewgenerator spec: backoffLimit: 0 # no retry template: metadata: labels: app.kubernetes.io/name: nextcloud app.kubernetes.io/component: previewgenerator spec: restartPolicy: Never serviceAccountName: server-cron containers: - name: run-previewgenerator-cron image: bitnami/kubectl imagePullPolicy: IfNotPresent command: ["/bin/bash"] args: - -xc - kubectl exec "$(kubectl get pods -l 'app.kubernetes.io/component=server' -o name)" -- /bin/bash -c '( if ! which sudo &>/dev/null; then apt update && apt install sudo; fi ) && sudo -u www-data php -f /var/www/html/occ preview:pre-generate'