<p>Now in GKE there is new tab while creating new K8s cluster</p>
<p><code>Automation</code> - Set cluster-level criteria for automatic maintenance, autoscaling, and auto-provisioning. Edit the node pool for automation like auto-scaling, auto-upgrades, and repair.</p>
<p>it has two options - <strong>Balanced (default)</strong> &amp; <strong>Optimize utilization (beta)</strong></p>
<p>cant we set this for older cluster any work around?</p>
<p>we are running old GKE version <strong>1.14</strong> we want to auto-scale cluster when <strong>70%</strong> of resource utilization of existing nodes.</p>
<p>Currently, we have <strong>2</strong> different pools - only <strong>one</strong> has auto node provisioning enable but during peak hour if HPA scales POD, New node taking some time to join the cluster and sometimes exiting node start crashing due to resource pressure.</p>

chagan
<p>You can set the autoscaling profile by going into:</p>
<ul>
<li><code>GCP Cloud Console</code> (Web UI) -&gt; <code>Kubernetes Engine</code> -&gt; <code>CLUSTER-NAME</code> -&gt; <code>Edit</code> -&gt; <code>Autoscaling profile</code></li>
</ul>
<p><a href="https://i.stack.imgur.com/6946C.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/6946C.png" alt="Autoscaling profile" /></a></p>
<blockquote>
<p>This screenshot was made on <code>GKE</code> version <code>1.14.10-gke.50</code></p>
</blockquote>
<p>You can also run:</p>
<ul>
<li><code>gcloud beta container clusters update CLUSTER-NAME --autoscaling-profile optimize-utilization</code></li>
</ul>
<hr />
<p>The official documentation states:</p>
<blockquote>
<p>You can specify which autoscaling profile to use when making such decisions. The currently available profiles are:</p>
<ul>
<li><code>balanced</code>: The default profile.</li>
<li><code>optimize-utilization</code>: Prioritize optimizing utilization over keeping spare resources in the cluster. When selected, the cluster autoscaler scales down the cluster more aggressively: it can remove more nodes, and remove nodes faster. <strong>This profile has been optimized for use with batch workloads that are not sensitive to start-up latency. We do not currently recommend using this profile with serving workloads.</strong></li>
</ul>
<p>-- <em><a href="https://cloud.google.com/kubernetes-engine/docs/concepts/cluster-autoscaler#autoscaling_profiles" rel="nofollow noreferrer">Cloud.google.com: Kubernetes Engine: Cluster autoscaler: Autoscaling profiles</a></em></p>
</blockquote>
<p>This setting (<code>optimize-utilization</code>) could not be the best option when using it for serving workloads. It will more aggressively try to <code>scale-down</code> (remove a node). It will automatically reduce the amount of available resources your cluster is having and could be more vulnerable to workload spikes.</p>
<hr />
<p>Answering the part of the question:</p>
<blockquote>
<p>we are running old GKE version 1.14 we want to auto-scale cluster when 70% of resource utilization of existing nodes.</p>
</blockquote>
<p>As stated in the documentation:</p>
<blockquote>
<p>Cluster autoscaler increases or decreases the size of the node pool automatically, based on the resource requests (rather than actual resource utilization) of Pods running on that node pool's nodes. It periodically checks the status of Pods and nodes, and takes action:</p>
<ul>
<li><strong>If Pods are unschedulable because there are not enough nodes in the node pool, cluster autoscaler adds nodes, up to the maximum size of the node pool</strong>.</li>
</ul>
<p>-- <em><a href="https://cloud.google.com/kubernetes-engine/docs/concepts/cluster-autoscaler#how_cluster_autoscaler_works" rel="nofollow noreferrer">Cloud.google.com: Kubernetes Engine: Cluster autoscaler: How cluster autoscaler works</a></em></p>
</blockquote>
<p>You can't directly scale the cluster based on the percentage of resource utilization (70%).
Autoscaler bases on inability of the cluster to schedule pods on currently existing nodes.</p>
<p>You can scale the amount of replicas of your <code>Deployment</code> by <code>CPU</code> usage with <a href="https://cloud.google.com/kubernetes-engine/docs/concepts/horizontalpodautoscaler" rel="nofollow noreferrer">Horizontal Pod Autoscaler</a>. This <code>Pods</code> could have a buffer to handle increased amount of traffic and after a specific threshold they could spawn new <code>Pods</code> where the <code>CA</code>( Cluster autoscaler) would send a request for a new node (if new <code>Pods</code> are unschedulable). This buffer would be the mechanism to prevent sudden spikes that application couldn't manage.</p>
<p>The buffer part and over-provisioning explained in details in:</p>
<ul>
<li><em><a href="https://cloud.google.com/solutions/best-practices-for-running-cost-effective-kubernetes-applications-on-gke#autoscaler_and_over-provisioning" rel="nofollow noreferrer">Cloud.google.com: Solutions: Best practices for running cost effective kubernetes applications on gke: Autoscaler and over-provisioning</a></em></li>
</ul>
<hr />
<hr />
<p>There is an extensive documentation about running cost effective apps on <code>GKE</code>:</p>
<ul>
<li><em><a href="https://cloud.google.com/solutions/best-practices-for-running-cost-effective-kubernetes-applications-on-gke" rel="nofollow noreferrer">Cloud.google.com: Solutions: Best practices for running cost effective kubernetes applications on gke </a></em></li>
</ul>
<p>I encourage you to check above link as there are a lot of tips and insights on (scaling, over-provisioning, workload spikes, <code>HPA</code>, <code>VPA</code>,etc.)</p>
<p>Additional resources:</p>
<ul>
<li><em><a href="https://cloud.google.com/kubernetes-engine/docs/how-to/node-auto-provisioning" rel="nofollow noreferrer">Cloud.google.com: Kubernetes Engine: Node auto provisioning</a></em></li>
</ul>
