<p>I need to create a Cron jobs at K8S.<br>
some jobs runs every minute , some of them every 5 minutes (24/7)</p>

<p>This jobs need to run rest call (get) to some components and 
to check the availability and if something is wrong (post) a rest call to other system</p>

<p>To handle this task I currently see two approaches </p>

<ol>
<li><strong>Create k8s cronjob</strong> - which is <strong>native</strong> k8s CRD and use <code>shell script</code> for it,  <a href="https://kubernetes.io/docs/concepts/workloads/controllers/cron-jobs/" rel="nofollow noreferrer">https://kubernetes.io/docs/concepts/workloads/controllers/cron-jobs/</a></li>
</ol>

<p><strong>PROS</strong>  is using K8S native way to handle such issue</p>

<p><strong>CONS</strong> - very hard to debug, logs debug etc </p>

<ol start="2">
<li><strong>Create k8s job/cronjob</strong> - which execute run a <strong>Golang program</strong> that will do use following library as cronjob</li>
</ol>

<p><strong>PROS</strong> - debug , logging etc , <a href="https://github.com/robfig/cron" rel="nofollow noreferrer">https://github.com/robfig/cron</a></p>

<p><strong>CONS</strong> - create some abstraction …</p>

<p>Any suggestion, recommendation which is better approach to use If I need a full control on those jobs</p>

NSS
<p>I'd approach this problem in several steps.</p>

<p>First, write the program that does the REST calls, checks the result, maybe posts the alert, and exits.  You can write this program in whatever language or toolkit you feel like.  If you're comfortable in Go, great; I might pick Python myself; it'd be possible as a shell script, but probably more awkward than many alternatives.  <strong>Build this program completely independently of Kubernetes.</strong> Test it as much as you need to convince yourself that it does what you want.</p>

<p>Once you've made the REST polling program work, and only then, build it into a Docker image; push it to a registry; and create a <a href="https://kubernetes.io/docs/concepts/workloads/controllers/cron-jobs/" rel="nofollow noreferrer">CronJob</a> Kubernetes resource that runs it on a schedule.</p>

<p>Given how you've described the task, I wouldn't write a specialized program just to replicate Kubernetes' built-in scheduled-task runner.  You could; I'd develop it the same way as above but use a Deployment instead of a CronJob; but probably the CronJob path is both simpler and more reliable.</p>
