How to define autoscale rule on memory in Azure VMSS

5/16/2019

I have create a VMSS in Azure Portal, to have the autoscale feature for my application. My application resided in Kubernetes cluster - around 10 microservices.

I want to create an Scale out rule, that if there is no enough memory , then increase the VM instance. But I don't see an option to set the rule based on memory. There are rules which we can define based on CPU utilization, disk space etc... But this won't help me to solve the problem. For my 10 microservice to work each service having 5 pods, i need to set a rule based on memory. If I set the rule based on CPU, the VM doesn;t scale up, as the CPU is not utilised much. Issue is with memory.

I get the error "0/3 nodes are available: 3 Insufficient pods. The node was low on resource: [MemoryPressure]. "

I read that the memory rule is not available in host metrics in Azure, but it can enabled via guest metrics. To enable guest metrics, i see below link .

https://docs.microsoft.com/en-us/azure/virtual-machine-scale-sets/virtual-machine-scale-sets-mvss-guest-based-autoscale-linux

But I don't see an option to edit the template as defined in the above link. There is only "export Template" option visible for VMSS, where you cannot edit the template.

Could anyone please help me on this issue , to define memory rule for VMSS in Azure ?

No option seen to enable guest metrics for VMSS. No option to edit the template, only "export Template" option visible, where you cannot edit the template.

-- user2733130
azure
azure-virtual-machine
azure-vm-scale-set
kubernetes
memory

1 Answer

5/16/2019

For the AKS autoscale, you just need to enable the autoscale function for your AKS cluster, set the min and max count of the nodes and then it will scale itself. You do not need to set the autoscale rule for it. Take a look at the AKS cluster autoscale.

When does Cluster Autoscaler change the size of a cluster?

Cluster Autoscaler increases the size of the cluster when:

  • there are pods that failed to schedule on any of the current nodes due to insufficient resources.
  • adding a node similar to the nodes currently present in the cluster would help.

Cluster Autoscaler decreases the size of the cluster when some nodes are consistently unneeded for a significant amount of time. A node is unneeded when it has low utilization and all of its important pods can be moved elsewhere.

And that what you have seen in the VMSS, the metric server is already installed in the high version AKS. If not install, you can install yourself and the steps here.

-- Charles Xu
Source: StackOverflow