<p>I have a cronjob that I want to execute twice a day, at 7h and 19h.</p>
<p>Here is the definition.</p>
<pre><code>apiVersion: batch/v1beta1
kind: CronJob
metadata:
  name: pamela
  namespace: influx
spec:
  schedule: &quot;* 7,19 * * *&quot;
  concurrencyPolicy: Replace
  jobTemplate:
    spec:
      template:
        spec:
          containers:
          - image: registry.gitlab.com/xxx/pamela:latest
            envFrom:
              - secretRef:
                  name: pamela-env
            name: pamela
            resources:
            volumeMounts:
            - mountPath: /raw
              name: pamela-claim
              subPath: raw
            - mountPath: /log
              name: pamela-claim
              subPath: log
          restartPolicy: Never
          volumes:
          - name: pamela-claim
            persistentVolumeClaim:
              claimName: pamela-claim
          nodeSelector:
            kops.k8s.io/instancegroup: nodes
          imagePullSecrets:
            - name: gitlab-registry
</code></pre>
<p>Thing is when it runs, it runs 3 times :</p>
<ul>
<li>at 2021-01-06T07:57:00Z</li>
<li>at 2021-01-06T07:58:00Z</li>
<li>at 2021-01-06T07:59:00Z</li>
</ul>
<p>It is to be mentioned that my job execution time is about 22sec</p>
<p>Why is it happening ?</p>

Juliatzin
<p>The first item in a cron schedule is the <em>minute</em>. The first <code>*</code> in your cron schedule <code>* 7,19 * * *</code> matches <em>every minute</em> between 7:00 and 7:59 (and also every minute between 19:00 and 19:59). In therory, your cron job should not run twice, but 120 times per day using this schedule.</p>
<p>To execute your cron job at <em>exactly</em> 7:00 and 19:00, use <code>0 7,19 * * *</code> as schedule.</p>
<p>For reference, the <a href="https://kubernetes.io/docs/tasks/job/automated-tasks-with-cron-jobs/#schedule" rel="nofollow noreferrer">Kubernetes documentation on <code>CronJob</code> resources</a> contains more information on the cron schedule format and itself links to the <a href="https://www.freebsd.org/cgi/man.cgi?crontab%285%29" rel="nofollow noreferrer">BSD cron documentation</a>.</p>
