distributed CRON in Kubernetes is still a work in progress (https://github.com/kubernetes/kubernetes/issues/2156).
What do you use for CRON jobs in Kubernetes today?
Do you recommend any solution that works well with Spring/JVM-based services? Spring/JVM startup time is quite high and if CRON scheduler started a new JVM for each job, startup time might be much higher than time of actual work - is there any solution that could run the job in existing JVM?
Thank you, Jakub
I wrote a small Go app that functions like cron but writes log info to stdout (no email!) and can be built into a static binary for easy containerization.
I built kubectl from source as a static binary and included it in the image (it may be a static binary in the most recent releases). Kubectl will automatically look for the service account token/certs in /var/run/secrets/kubernetes.io/serviceaccount/ so you should be good to go unless you're not using the default service account.
I then set up a crontab to run kubectl to create a job at the period that I wanted. The crontab and yaml files for the jobs can be mounted as a secret. You can either use conf2kube or some other way of generating the secrets. I wrote a simple python script.
It's totally a workaround until there is proper support but I hope that helps.