0

When my ConfigMap changes, I'd like my CronJob to restart.

There's a trick in Helm to make this happen for Deployments using an annotation that contains the SHA of the ConfigMap (see here or here).

This works for my Deployment, doing kubectl get deployments show the AGE is just a couple minutes.

But not my CronJob, doing kubectl get cronjobs, the "AGE" is still hours old implying they haven't restarted.

Garrett
  • 4,007
  • 2
  • 41
  • 59

1 Answers1

2

So, it turns out CronJobs don't need to be restarted when the ConfigMap changes anyway. Everytime a Job is created, the Pod that spins up to execute the Job seems to use the latest ConfigMap values anyway.

Garrett
  • 4,007
  • 2
  • 41
  • 59
  • 1
    yea. that's how it's works with configmap, secret both if you are using those with cronjob with deployment also configmap get auto-updated if you have mounted it. Extra if you would like to Read more : https://faun.pub/update-configmap-without-restarting-pod-56801dce3388 – Harsh Manvar Jun 29 '22 at 04:51