Environment Variables inside a Cronjob in Kubernetes

3/27/2018

I have a nodejs application that runs every month and fetches data from an external database. It has some environment variables. Can I run this as a Cronjob in Kubernetes and is it possible to define env variables and also source the env variable from secretfile in the cronjob ?

-- Anshul Tripathi
kubernetes
kubernetes-cronjob

1 Answer

3/27/2018

Ofcourse, CronJob spec takes the same template as Pod spec. This means you can specify env variables (reference from secrets or config maps) just like you would do it for a Pod.

-- tselvan
Source: StackOverflow