Running A cronjob in a pod in Kubernetes

0 votes

I have a backend nodeJS application running in a kubernetes cluster. Now I want to run two cron jobs to be scheduled every month. The cron jobs are in a JS file. How do I create a job that runs those JS files in the pod running that service every month using Kubernetes ? 

Sep 17, 2018 in Kubernetes by Hannah
• 16,210 points
313 views

1 answer to this question.

0 votes

Unfortunately, you cannot run the CronJob inside a container of your application.

But you can create a container which will contain your cronjob and necessary environment for running it and schedule to run that pod by a CronJob.

answered Sep 17, 2018 by Kalgi
• 41,990 points

Related Questions In Kubernetes

+1 vote
1 answer
0 votes
1 answer

Not able to access kubernetes api from a pod in azure

Follow these steps Add --bind-address=0.0.0.0 option to the line https://github.com/kubernetes/kubernetes/blob/v1.2.0/docs/getting-started-guides/coreos/azure/cloud_config_templates/kubernetes-cluster-main-nodes-template.yml#L218  Created ...READ MORE

answered Aug 30, 2018 in Kubernetes by Kalgi
• 41,990 points
76 views
0 votes
1 answer
0 votes
1 answer

Environment Variables inside a Cronjob in Kubernetes

Ofcourse you can. Cron job specification is ...READ MORE

answered Sep 18, 2018 in Kubernetes by Kalgi
• 41,990 points
293 views
0 votes
1 answer
0 votes
3 answers

Error while joining cluster with node

Hi Kalgi after following above steps it ...READ MORE

answered Jan 17 in Others by anonymous
2,943 views
+3 votes
1 answer
0 votes
1 answer

Running a cronjob in kubernetes

You will find the CronJobresource in the batch/v1beta1 API group. ...READ MORE

answered Sep 6, 2018 in Kubernetes by Kalgi
• 41,990 points
38 views
0 votes
3 answers

Retry pull image in a kubernetes pod

If the Pod is part of a ...READ MORE

answered Aug 29, 2018 in Kubernetes by Hannah
• 16,210 points
1,203 views