Correct way to scale an Azure Kubernetes Cluster under specific conditions

7/28/2019

Here is the gist of a question that I got on Azure Kubernetes Cluster Scaling: An AKS cluster is defined with a max of 32 nodes. Occasionally, it needs more than 32 nodes, pick two best choices from the following four:

Cluster autoscaler
Container Instances
Horizontal Pod Scaler
Manual Scaling

Here is a link to the relevant documentation from Microsoft Azure site:

https://docs.microsoft.com/en-us/azure/aks/concepts-scale

Having gone through it, I still can't figure out which two are the best choices. As I see it, both Cluster autoscaler and Horizontal Pod Scaler can work together to automate scaling, but they must obey the 32 max node limit defined at the deployment time? Otherwise, you have to work with Container Instances and Manual Scaling?

I don't have enough real-life experience trying to answer this scenario. Can someone with more experience advise?

-- Bharat
azure
kubernetes
scaling

2 Answers

7/29/2019

To autoscale the AKS, the best way is to use the autoscale both in the AKS cluster and the HPA. The HPA is the autoscale for the pods and the AKS cluster autoscale is for the nodes.

HPA is set to meet the requirement that you define for the pods: in which condition the number of the pods should increase or decrease. And the AKS autoscale, it's an automatic rule that will increase the number of the nodes if the resources are not enough, or decrease the number of the nodes if the need of the resources is less than the existing. Cluster autoscaler is typically used alongside the horizontal pod autoscaler and it also shows in Cluster autoscaler as below:

Cluster autoscaler is typically used alongside the horizontal pod autoscaler. When combined, the horizontal pod autoscaler increases or decreases the number of pods based on application demand, and the cluster autoscaler adjusts the number of nodes as needed to run those additional pods accordingly.

For the limitation, there will be three points:

  1. the min and max number of the pods you set for the autoscale rules to meed the requirement.
  2. the min and max number of the AKS cluster nodes you set for the autoscale rules, actually, this is set for needed of resources and you can also limit the cost through these settings.
  3. the limitation for the number of the nodes in the AKS cluster. According to this, the max number of the AKS nodes must not more than 100.

Hope this will help you understand the autoscale in AKS. Any more questions, please let me know.

-- Charles Xu
Source: StackOverflow

7/29/2019

With 2 ways of scaling: Manual and Automated Scaling, you define min or max limit for containers (Pods) and nodes in manifests files and in Azure AKS portal respectively if you are following manual scaling.

For automated scaling, increasing number of containers (Pods) becomes responsibility of HPA (Horizontal Pod AutoScaler) and cluster-autoscaler for autoscaling cluster nodes.

Usually not all the components in an architecture need to be configured as HPA, you specifically plan and figure out which component or service should require HPA and which shouldn't.

Definitely, you don't want Manual Scaling since no one is willing to get up in the middle of the night and increase the limit of resources to deal with traffic spikes. HPA has no limits, nodes in a cluster has limit which I suppose is 100 nodes not 32. You can increase further by requesting at Azure Support Request.

-- Janshair Khan
Source: StackOverflow