How to trigger the run of a Helm job manually ONLY?

3/9/2020

How can I run a specific shell with mounted volumes for debugging purposes, and not run it automatically?

What I found best was a cronjob run on the 29th of February that I can trigger manually it would ultimately be run on an unwanted schedule.

Also, I could do it with a kubernetes simple pod template, but I need helm templating.

-- Vincent J
kubernetes-helm

1 Answer

3/9/2020

The best way I found was to run it the 30th of February.

apiVersion: batch/v1beta1
kind: CronJob
metadata:
  name: shell-job
  labels:
    app: {{ template "acs.fullname" . }}
    chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
    release: "{{ .Release.Name }}"
spec:
  # 30th of February run, will never be run automatically, only when we trigger it
  schedule: "0 0 30 2 0"
  jobTemplate:
    spec:
      template:
        spec:
          containers:
            - name: shell-job
              image: debian
              command: ["sleep", "36000"]

then trigger it with:

kubectl create job --from=cronjob/shell-job shell-job
kubectl exec -it shell-job bash

and to delete:

kubectl delete job/shell-job
-- Vincent J
Source: StackOverflow