如何使用Azure Pipelines为kubernetes设置自动缩放比例(在同一节点上并向外扩展)? [英] How to set auto-scaling for kubernetes (both in same node and scale out) by using Azure Pipelines?
问题描述
我想在Azure Pipelines中设置自动缩放功能,以使用Kubernetes部署容器.如果要按以下规则自动缩放,怎么办:
I would like to set auto-scaling feature in Azure Pipelines for deployment of containers with Kubernetes. How can I do that if I want to auto-scaling by below rules:
- 取决于编号. ServiceBus消息队列中的消息数量
- 它将首先在节点内部扩展(更好地设置节点中的最大Pod,因为它取决于线程号?)
- 如果在一个节点中达到最大Pod,则它将向外扩展以使用另一个节点(也可以扩展为使用该节点的最大Pod吗?即1个节点3个Pod,2个节点6个Pod,而总共4/5个Pod) )
- depeneds on no. of messages in ServiceBus message queue
- it will scale inside a node first (better to set maximum pods in node as it depends on thread no.?)
- if reach maximum pods in a node, then it will scale out to use another node (can scale to use maximum pods of node as well?i.e. 3 pods for 1 node, 6 pods for 2 nodes without total 4/5 pods)
最后,如何使用Azure Pipelines进行设置? (以上仅在Yaml文件中设置,对吧?)
Finally, how to set by using Azure Pipelines? (above only set in Yaml file, right?)
推荐答案
我不认为有一种方法可以根据ServiceBus队列中的消息数量(至少是kubernetes本地)进行扩展-应该使用- Horizontal Pod Autoscaler 与
I dont think there is a way to scale based on number of message in the ServiceBus queue (at least native to kubernetes), that being said - you should use Horizontal Pod Autoscaler with Cluster Autoscaler. These are native kubernetes mechanisms to scale pods\cluster based on the load on the pods.
使用AKS进行预览: https://docs.microsoft.com /en-us/azure/aks/autoscaler
Its in preview with AKS: https://docs.microsoft.com/en-us/azure/aks/autoscaler
我见过的另一种方法:使用cronJobs.只需每分钟使用cronJobs启动消息处理器,并使其扩展即可.这是一种简单的方法,不需要太多的配置.您可以使用这种方法删除pod自动缩放器,而仅使用群集自动缩放器,我没有使用这种方法,但是看起来很有希望.
Another approach I've seen: using cronJobs. Just start your message processors every minute with cronJobs and make them scale. this is an easy approach that requires not a lot of configuration. You can drop pod autoscaler with this approach and only use cluster autoscaler, I haven't used this approach, but it looks promising.
这篇关于如何使用Azure Pipelines为kubernetes设置自动缩放比例(在同一节点上并向外扩展)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!