Kubernetes通过基于时间的触发来扩展Pod [英] Kubernetes Scaling up pods by time based trigger

查看:55
本文介绍了Kubernetes通过基于时间的触发来扩展Pod的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个在Kubernetes上运行的服务器来处理每小时的处理作业.考虑使用服务来暴露Pod,并使用(外部)cron作业来命中负载平衡器,以便kubernetes可以根据需要自动缩放以处理更高的负载.但是在实现中,如果cron作业同时发送100个请求,而只有一个Pod,则所有流量都将流向该Pod,而随后启动的Pod仍然没有任何流量要处理.

I have a server running on Kubernetes to handle hourly processing jobs. Thinking of using a service to expose the pods, and using an (external) cron job to hit the load balancer so that kubernetes can autoscale to handle the higher load as required. However in implementation, if the cron job sends, say, 100 requests at the same time while there's only 1 pod, all the traffic will go to that pod whereas subsequently spun up pods will still not have any traffic to handle.

如何解决这个问题?在提出请求之前,我是否可以先使用cron作业来放大豆荚?还是应该延迟请求以便给豆荚腾出时间?或其他建议也欢迎!

How can I get around this issue? Is it possible for me to scale up the pods first using a cron job before making the requests? Or should I make requests with a time delay so as to give time for the pods to get spun up? Or other suggestions are also welcome!

推荐答案

我编写了一个简单的基于客户端访问的应用程序,您可以将其与CronJob配对以扩大部署规模.您可以从中汲取灵感并自己编写或使用它.我希望这会有所帮助.

I wrote a simple client go based application which you can pair with CronJob to scale up ir down the deployment. You can take inspiration from it and write it yourself or just use it. I hope this helps.

https://github.com/balchua/boink

这篇关于Kubernetes通过基于时间的触发来扩展Pod的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆