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?
Asked
Active
Viewed 1,513 times
2 Answers
1
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.
-
Using a shell script how exactly do we connect to a DB in a different POD. Given, I have the servicediscovery.json but don't have/know the exact command to connect. – Srijoni Biswas Jan 10 '19 at 07:21
0
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
- 7,565
- 2
- 21
- 24
-
My base image has crontab.daily but however I am unable to recreate with it. – Srijoni Biswas Dec 03 '18 at 06:27