How to set auto-scaling for kubernetes (both in sa

2019-07-26 13:20发布

问题:

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:

  1. depeneds on no. of messages in ServiceBus message queue
  2. it will scale inside a node first (better to set maximum pods in node as it depends on thread no.?)
  3. 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)

Finally, how to set by using Azure Pipelines? (above only set in Yaml file, right?)

回答1:

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.

Its in preview with AKS: https://docs.microsoft.com/en-us/azure/aks/autoscaler

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.