<p>I'm running an instance of microk8s and attempting to get a CronJob running every 60 seconds, but it's simply not working. It's my understanding CronJob's shouldn't need any manual intervention to kick them off, but this system has been up for over a month and I didn't see the pod for the cron job (in <em>any</em> state), so I decided I'd try kicking it off manually with <code>kubectl create job --from=cronjob/health-status-cron health-status-cron</code>. After manually kicking it off, the job completed successfully:</p>
<pre><code>health-status-cron-2hh96                   0/1     Completed   0          17h
</code></pre>
<p>I was hoping Kubernetes would then start scheduling future jobs, but it didn't. Following is my manifest (some of it is templated with Helm, but that shouldn't matter):</p>
<pre><code>apiVersion: batch/v1beta1
kind: CronJob
metadata:
  name: health-status-cron
  namespace: {{ .Values.global.namespace }}
  labels:
    app.kubernetes.io/managed-by: Helm
    app.kubernetes.io/release-name: {{ .Release.Name }}
    app.kubernetes.io/release-namespace: {{ .Release.Namespace }}
spec:
  schedule: &quot;* * * * *&quot;
  concurrencyPolicy: Replace
  successfulJobsHistoryLimit: 1
  jobTemplate:
    spec:
      template:
        spec:
          containers:
          - name: health-status-cron
            image: busybox
            imagePullPolicy: IfNotPresent
            command:
            - /bin/sh
            - -c
            - /usr/bin/curl -k http://restfulservices/api/system-health
          restartPolicy: OnFailure
</code></pre>
<p>Also of note, according to the following, the job hasn't been scheduled for 35 days:</p>
<pre><code>$ k -ntango get cronjobs
NAME                   SCHEDULE    SUSPEND   ACTIVE   LAST SCHEDULE   AGE
health-status-cron     * * * * *   False     0        35d             36d
</code></pre>
<p>At this point, I have absolutely no clue what I'm doing wrong or why this particular job isn't running. Any help is greatly appreciated.</p>
<p>Edit: I ended up blowing away the entire namespace and redeploying. I still don't know the underlying cause, unfortunately, but everything seems to work now.</p>

senfo
<p>A couple of other things you can check:</p>
<ol>
<li>Do you have any cron pods with a <code>failed</code> status? If you do, check those pods for why.</li>
<li>Did it work previously and then suddenly stop?</li>
<li>Does the cronjob resource have anything in the events? <code>kubectl describe cronjob health-status-cron -n tango</code></li>
<li>Does the code your cron runs take &gt; 1 minute to complete? If so, your schedule is too aggressive, and you might want to loosen the schedule</li>
<li>The cronjob controller also has some limitations you may want to check: <a href="https://kubernetes.io/docs/concepts/workloads/controllers/cron-jobs/#cron-job-limitations" rel="nofollow noreferrer">https://kubernetes.io/docs/concepts/workloads/controllers/cron-jobs/#cron-job-limitations</a>. Specifically the concept of &quot;missed jobs&quot;. If the cronjob controller &quot;misses&quot; scheduling 100 or more jobs, it will &quot;freeze&quot; the job and not schedule it anymore. Do you scale down the cluster or similar when it is not in use?</li>
<li>Do you have any custom/third-party webhooks or plugins installed in the cluster? These can interfere with pod creation.</li>
<li>Do you have any <em>jobs</em> created in the namespace? <code>kubectl get jobs -n tango</code> If you find a ton of job objects, check them to see why they did not generate pods.</li>
</ol>
<p>I encountered a somewhat similar issue in 2020 (writeup has a link to the issue I raised in the Kubernetes project itself): <a href="https://blenderfox.com/2020/08/07/the-snowball-effect-in-kubernetes/" rel="nofollow noreferrer">https://blenderfox.com/2020/08/07/the-snowball-effect-in-kubernetes/</a></p>
