I am running an API Platform backend which deploys using Helm. The chart for the PHP server deployment is here:
https://github.com/api-platform/api-platform/blob/main/helm/api-platform/templates/deployment.yaml
I am hoping to run a Kubernetes CronJob that creates a full instance/pod of that service so that I can run some queries and send some notification emails based off of this on a regular time-scheduled basis, using the database, mailer & template service that is part of my main PHP server setup.
All of the tutorials for CronJob in Kubernetes do not seem to reference using a Deployment, but refer to a job template. Worst case scenario is that I need to recreate the entire Deployment template as a job template (it's quite large, as you can see from above), and maintaining two versions of the same thing is impractical long term.
Completely open to the idea that I am approaching this incorrectly and there's a better appraoch.
Currently I have the example CronJob working fine:
spec:
concurrencyPolicy: Allow
failedJobsHistoryLimit: 1
jobTemplate:
spec:
template:
spec:
containers:
- command:
- echo
- hello world
image: bash
imagePullPolicy: Always
name: hello
restartPolicy: Never
terminationGracePeriodSeconds: 30
schedule: '*/5 * * * *'
successfulJobsHistoryLimit: 3
suspend: false
but need to run a command for the server (in my case, bin/console notifications:dailydigest
). I have the actual PHP server in a container on AWS in their ECR, which is what is used for our deployments. I see that we have an image listed here, but it isn't clear to me how I could use that vs. the deployment yaml
file I'm using with all of the CLI variables that are pushed when we run helm upgrade --set [all the variables]