-2

Cronjobs are not running any job on its scheduled times, the jobs runs only when one or more cronjobs are deleted. Is there some cronjob number limit ? Where to get log messages of this problem?

EDIT: I have exactly the same environment for development and production working perfectly, this only occurs in testing environment. This problem occurs daily and the workaround that I found was to delete one or more cronjobs to run what I want in that moment.

---
apiVersion: batch/v1beta1
kind: CronJob
metadata:
  name: rcj-homebroker-bolsa
  namespace: <KUBE_NAMESPACE>
spec:
  schedule: "0 14 * * 1-5"
  startingDeadlineSeconds: 600
  concurrencyPolicy: Forbid
  successfulJobsHistoryLimit: 5
  failedJobsHistoryLimit: 5
  jobTemplate:
    spec:
      activeDeadlineSeconds: 18000
      backoffLimit: 0
      template:
        metadata:
          labels:
            cronjob: rcj-homebroker-bolsa
      template:
        spec:
          containers:
          - name: rcj-homebroker-bolsa
            image: <DOCKER_TAG>
            command: ["/bin/bash"]
            args: ["./processBolsa.sh"]
            lifecycle:
              preStop:
                exec:
                  command:
                  - /bin/bash
                  - pre-stop.sh
caslurjf
  • 1
  • 2

1 Answers1

2

You set concurrency policy of CronJob to Forbid which means, 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.

Please set concurrency policy to Allow (default)- the cron job allows concurrently running jobs.

concurrencyPolicy: Allow

In exceptional situation use Replace flag:- 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.

Please take a look: concurrency-policy.

Malgorzata
  • 6,409
  • 1
  • 10
  • 27