<p>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.</p>

<p>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.</p>

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

<p>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 .</p>

<p><a href="https://learn.microsoft.com/en-us/azure/virtual-machine-scale-sets/virtual-machine-scale-sets-mvss-guest-based-autoscale-linux" rel="nofollow noreferrer">https://learn.microsoft.com/en-us/azure/virtual-machine-scale-sets/virtual-machine-scale-sets-mvss-guest-based-autoscale-linux</a></p>

<p>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.</p>

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

<p>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.</p>

<p>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 <a href="https://learn.microsoft.com/en-us/azure/aks/cluster-autoscaler#about-the-cluster-autoscaler" rel="nofollow noreferrer">AKS cluster autoscale</a>.</p>

<p><strong>When does Cluster Autoscaler change the size of a cluster?</strong></p>

<p>Cluster Autoscaler increases the size of the cluster when:</p>

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

<p>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.</p>

<p>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 <a href="https://learn.microsoft.com/en-us/azure/aks/tutorial-kubernetes-scale#autoscale-pods" rel="nofollow noreferrer">here</a>.</p>
