<p>I have a cluster in Google Kubernetes Engine, in that cluster there is a workload which runs every 4 hours, its a cron job that was set up by someone. I want to make that run whenever I need it. I am trying to achieve this by using the google Kubernetes API, sending requests from my app whenever a button is clicked to run that cron job, unfortunately the API has no apparent way to do that, or does not have a way at all. What would be some good advice to achieve my goal?</p>

Vlad Tanase
<p><em>This is a Community Wiki answer, posted for better visibility, so feel free to edit it and add any additional details you consider important.</em></p>
<p><a href="https://kubernetes.io/docs/concepts/workloads/controllers/cron-jobs/" rel="nofollow noreferrer"><code>CronJob</code></a> resource in <strong>kubernetes</strong> is not meant to be used one-off tasks, that are run on demand. It is rather configured to run on a regular schedule.</p>
<p><a href="https://stackoverflow.com/users/7424896/manuel-polacek">Manuel Polacek</a> has already mentioned that in his comment:</p>
<blockquote>
<p>For this scenario you don't need a cron job. A simple bare pod or a
job would be enough, i would say. You can apply a resource on button
push, for example with kubectl – Manuel Polacek Apr 24 at 19:25</p>
</blockquote>
<p>So rather than trying to find a way to run your <code>CronJobs</code> on demand, regardless of how they are originally scheduled (usually to be repeated at regular intervals), you should copy the code of such <code>CronJob</code> and find a different way of running it. A <a href="https://kubernetes.io/docs/concepts/workloads/controllers/job/" rel="nofollow noreferrer"><code>Job</code></a> fits ideally to such use case as it is designed to run one-off tasks.</p>
