CronJob Properties

In Kubernetes, a CronJob is a resource type that allows you to run scheduled tasks or jobs at specific times or intervals within your cluster. It is particularly useful for automating repetitive tasks, such as backups, data processing, or maintenance activities.

CronJob Properties describes the CronJob properties:

Table 1. CronJob Properties
Name Description
cronJob.enabled Set this to true to enable cronJob in the application's Helm chart. The default value is false.
cronJob.jobs The cronJob specification.
cronJob.jobs.[name].schedule The schedule for the cronJob.
cronJob.jobs.[name].image The image for the cronJob.
cronJob.jobs.[name].command Defines a command for the job container.
cronJob.jobs.[name].args Arguments for the job container.
cronJob.jobs.[name].resources Resources for the job container.
cronJob.jobs.[name].additionalLabels More labels for the cronJob.
cronJob.jobs.[name].annotations Annotations for the cronJob.
cronJob.jobs.[name].successfulJobsHistoryLimit The number of histories to keep for successful runs of the cronJob.
cronJob.jobs.[name].concurrencyPolicy The concurrency policy of the cronJob.
cronJob.jobs.[name].failedJobsHistoryLimit The number of histories to keep for failed runs of the cronJob.
cronJob.jobs.[name].volumeMounts Volume mounts for the cronJob.
cronJob.jobs.[name].volumes Volumes for the cronJob.
cronJob.jobs.[name].nodeSelector The node selector for the cronJob.
cronJob.jobs.[name].affinity The affinity for the cronJob.
cronJob.jobs.[name].tolerations The tolerations for the cronJob.
cronJob.jobs.[name].restartPolicy The restart policy for the cronJob.
cronJob.jobs.[name].imagePullSecrets Image pull secrets for the cronJob.
cronJob.jobs.[name].activeDeadlineSeconds The active deadline seconds for the cronJob.
cronJob.jobs.[name].backoffLimit The back-off limit for the cronJob.
cronJob.jobs.[name].additionalPodAnnotations More pod annotations for the cronJob.
cronJob.jobs.[name].additionalPodLabels More pod labels for the cronJob.
cronJob.jobs.[name].topologySpreadConstraints Topology spread constraints for the cronJob.
cronJob.jobs.[name].securityContext The security context for the cronJob.
cronJob.jobs.[name].rbac The role-based access control parameters for the cronJob.
This is an example of a CronJob properties configuration:
cronJob:
  enabled: true
  jobs:
    db-migration:
      schedule: "* * * 8 *"
      imagePullSecrets:
        - name: nexus-secret
      image:
        repository: docker.io/nginx
        tag: v1.0.0
      env:
        KEY:
          value: VALUE
      command: ["/bin/bash"]
      args: ["-c","sleep 5000"]
      resources:
        requests:
          memory: 5Gi
          cpu: 1