<p>I have a Kubernetes Deployment, in whose Pods I need a command run periodically.
The Kubernetes <code>CronJob</code> object creates a new Pod.
I would prefer to specify a cronjob, that runs inside the container of the Pod.
Is there any way, I can specify this in the deployment yaml?</p>
<p>I have no access to the Dockerfile, but am using pre-built Images.</p>

sekthor
<p>As far as I can tell, what I was trying to do is actually not really meant to be done.
I was not able to find a reasonable way to achieve this with purely pre-built images. All solutions ended up requiring some form of custom image as a sidecar or modifying the original Dockerfile.</p>
<p>How I solved my problem:</p>
<p>My CronJob was supposed to check a file mounted into the container file system as a ConfigMap, I opted for a sidecar, that has the ConfigMap mounted as well.
Instead of a conventional CronJob I opted for a shell script, that periodically did what I needed it to do and had this shell script run as the entry point of my alpine sidecar.</p>
