How to run a job in openshift to schedule a particular script?

11/28/2018

I have an existing POD containing a DB. I have a script containing executable queries in that container. I need to schedule the execution of the script. How do I go about doing this?

-- Srijoni Biswas
cassandra
kubernetes
openshift
openshift-3
scripting

2 Answers

12/5/2018

OpenShift has a "cronjob" resource type which can schedule a job to run at specific intervals. You can read more about it here.

You can create a custom image which contains the client to connect to your DB and supply it with the credentials mapped as secrets. This can run your executable queries at the interval you've set for the job.

-- Badri
Source: StackOverflow

11/28/2018

You can have 2 options

1) If your base image comes with crontab simply create a crontab using the usual commands here. If the base image doesn't have the crontab you can add it as in this example.

2) Use the openshift 'Scheduled Jobs' that comes with Kubernetes see here

-- Essex Boy
Source: StackOverflow