Kubernetes中POD的预定扩展 [英] Scheduled scaling for PODs in Kubernetes

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

问题描述

我有一个可扩展的部署,可预测的负载变化取决于时间.如何使部署准备好进行加载(例如,我想每天晚上16:00至23:00将Pod数量加倍).Kubernetes是否提供这种工具?

I have a scaled deployment with predictable load change depends on time. How can I make my deployment prepared to the load (for example, I want to double pods number every evening from 16:00 to 23:00). Does Kubernetes provides such tool?

我知道Kubernetes吊舱正在使用水平吊舱自动缩放器,可根据CPU利用率或自定义指标来缩放广告连播的数量.但这是被动的方法,我正在寻找主动的方法.

I know Kubernetes pods are scaling with Horizontal Pod Autoscaler, which scales the number of pods based on CPU utilisation or custom metric. But it is reactive approach, I'm looking for proactive.

推荐答案

通过Google进行快速搜索可以将您引导至此处:

A quick google search would direct you here: https://github.com/kubernetes/kubernetes/issues/49931

从本质上讲,到目前为止,最好的解决方案是为pod的主容器运行一个sidecar容器,该容器可以使用kubernetes api通过一个简单的bash脚本根据时间段自行扩展,或者编写CRD自己对基于时间的事件做出反应(现在是下午6点),就像这样:

In essence the best solution as of now, is to either run a sidecar container for your pod's main container, which could use the kubernetes api to scale itself up based on a time period with a simple bash script, or write a CRD yourself that reacts to time based events (it is 6pm), something like this one:

https://github.com/amelbakry/kube-schedule-scaler

监视具有类似cron规范的部署注释,并做出相应的反应.

which watches annotations with cron-like specs on deployments and reacts accordingly.

这篇关于Kubernetes中POD的预定扩展的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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