<p>I am using kubernetes v1.11.1 configured using kubeadm consisting of five nodes and hundreds of pods are running. How can I enable or configure cluster autoscaling based on the total memory utilization of the cluster?  </p>

Ratul
<p>K8s cluster can be scaled with the help of Cluster Autoscaler(CA) <a href="https://github.com/kubernetes/autoscaler/tree/master/cluster-autoscaler" rel="nofollow noreferrer">cluster autoscaler github page</a>, find info on AWS CA there.</p>

<p>It is not scaling the cluster based on “total memory utilization” but based on “pending pods” in the cluster due to not enough available cluster resources to meet their CPU and Memory requests. 
Basically, Cluster Autoscaler(CA) checks for pending(unschedulable) pods every 10 seconds and if it finds any, it will request AWS Autoscaling Group(ASG) API to increase the number of instances in ASG. When a node to ASG is added, it then joins the cluster and becomes ready to serve pods. After that K8s Scheduler allocates “pending pods” to a new node. </p>

<p>Scale-down is done by CA checking every 10 seconds which nodes are unneeded and the node is considered for removal if: the sum of CPU and Memory Requests of all pods is smaller than 50% of node’s capacity, pods can be moved to other nodes and no scale-down disabled annotation. </p>

<p>If K8s cluster on AWS is administered with Kubeadm, all the above holds true. So in a nutshell(intricate details omitted, refer to the doc on CA): </p>

<blockquote>
  <p>Create Autoscaling Group(ASG) <a href="https://docs.aws.amazon.com/autoscaling/ec2/userguide/AutoScalingGroup.html" rel="nofollow noreferrer">aws ASG doc</a>.</p>
  
  <p>Add tags to ASG like k8s.io/cluster-autoscaler/enable(mandatory),
  k8s.io/cluster-autoscaler/cluster_name(optional).</p>
  
  <p>Launch “CA” in a cluster following the offical doc.</p>
</blockquote>
