<p>I need a cron job to run every 5 minutes. If an earlier cron job is still running, another cron job should not start. I tried setting concurrency policy to Forbid, but then the cron job does not run at all.</p>

<ol>
<li>Job gets launched every 5 minutes as expected, but it launches even if the earlier cron job has not completed yet</li>
</ol>

<pre class="lang-yaml prettyprint-override"><code>spec:
  concurrencyPolicy: Allow
  schedule: '*/5 * * * *'
</code></pre>

<ol start="2">
<li>This is supposed to solve the problem, but the cron job never gets launched with this approach</li>
</ol>

<pre class="lang-yaml prettyprint-override"><code>spec:
  concurrencyPolicy: Forbid
  schedule: '*/5 * * * *'
</code></pre>

<ol start="3">
<li>Setting the startingDeadlineSeconds to 3600, or even to 10, did not make a difference.</li>
</ol>

<pre class="lang-yaml prettyprint-override"><code>spec:
  concurrencyPolicy: Forbid
  schedule: '*/5 * * * *'
  startingDeadlineSeconds: 10
</code></pre>

<p>Could someone please help me here?</p>

Satish Eddhu Thulasiraman 
<p>From kubernetes documentation</p>
<p>Concurrency Policy specifies how to treat concurrent executions of a job that is created by this cron job. The spec may specify only one of the following concurrency policies:</p>
<p><strong>Allow (default)</strong>: The cron job allows concurrently running jobs</p>
<p><strong>Forbid</strong>: The cron job does not allow concurrent runs; if it is time for a new job run and the previous job run hasn’t finished yet, the cron job skips the new job run</p>
<p><strong>Replace</strong>: If it is time for a new job run and the previous job run hasn’t finished yet, the cron job replaces the currently running job run with a new job run</p>
<p>In your case <strong>'concurrencyPolicy: Forbid'</strong> should work. It will not allow new job to be run if the previous job is still running. The problem is not with concurrencyPolicy in your case.</p>
<p>It might be related to startingDeadlineSeconds. can you remove it and try</p>
