Pergunta

I have to implement a feature in an existing application, which requires calling an API every minute. My app's microservices runs in Kubernetes environment.

To achieve this, my first thought is Kubernetes cron job. But thinking little deep it occurred to me that a Kubernetes cron job, every minute will pull an image from a container registry, spin up that image, check for many validation if job has failed and it requires re-run etc etc...just to call one API.

Is it an over-kill?

Is there a way in Kubernetes to run a scheduler (like Google Cloud Scheduler) which simply calls an API (which is configurable)?

Thanks in advance!!!

Foi útil?

Solução

I'd probably just create a very minimal Docker image that runs continuously and calls APIs according to a schedule. There are various cron containers in the Docker registry which could be used as starting point, or you could write a very simple scheduler yourself in Python or some other readily available language.

Licenciado em: CC-BY-SA com atribuição
scroll top