Bobcares

GKE Cluster Autoscaler | A Quick Guide

by | Jul 6, 2022

GKE Cluster Autoscaler improves workload availability while controlling costs. Here, we go over the GKE Cluster Autoscaler in detail, including how it works.

Bobcares responds to all inquiries, large or small, as part of our Google Cloud Platform Support Service.

Let’s take a closer look at GKE Cluster Autoscaler.

GKE Cluster Autoscaler

The cluster autoscaler in GKE automatically resizes the number of nodes in a given node pool based on workload demands. Therefore we only need to specify a minimum and maximum size for the node pool, and the GKE Cluster Autoscaler will do the rest.

 

gke cluster autoscaler

GKE Cluster Autoscaler- Working Principle

Cluster autoscaler operates on a per-node pool basis. By adding or removing VM instances from the underlying Compute Engine Managed Instance Group for the node pool, Cluster autoscaler automatically changes the size of the node pool. The cluster autoscaler takes the scaling decisions. Generally, autoscaler take decisions considering resource requests. It takes action after checking the status of nodes and pods regularly.

If there are not enough nodes in the node pool, pods are unscheduled. Then cluster autoscaler adds maximum nodes of the node pool size.
Cluster autoscaler also removes nodes until the node pool is down to the bare minimum size. This occurs when nodes are underutilized and all pods can be scheduled even with fewer nodes in the node pool. Cluster autoscaler won’t try to scale down a node if there are pods on it that can’t move to other nodes in the cluster. The node will stop if pods can be moved to other nodes but the node cannot be gracefully drained after a timeout period.

GKE Cluster Autoscaler Operating Standards

Cluster autoscaler checks the following while adjusting a node pool:

  • We can restart all replicated pods on some other node even though there is a short interruption.
  • Customers or admins are not manually managing nodes.
  • A single node pool’s nodes share the same labels.
  • Consider the lower cost of node pools containing Spot VMs.
  • After the initial cluster or node pool creation, the labels that were manually added are not recorded.

Zone-Wide Balancing

When scaling up, cluster autoscaler attempts to keep managed instance group sizes balanced if the node pool contains multiple managed instance groups of the same instance type. This can also help to avoid an uneven distribution of managed instance groups across multiple zones of a node pool.

Maximum-Minimum Range of Node Pool

We can set the minimum and maximum size for the node pool in the cluster. Then the GKE cluster autoscaler decides within this range.

Autoscaling Constraints

Each zone has a minimum and a maximum number of nodes if the cluster has nodes in multiple zones. For instance, the below command can autoscale a multi-zonal cluster with six nodes across three zones initially. The minimum is set to one node per zone and a maximum as four nodes per zone:

gcloud container clusters create example-cluster \
--num-nodes 2 \
--zone us-central1-a \
--node-locations us-central1-a,us-central1-b,us-central1-f \
--enable-autoscaling --min-nodes 1 --max-nodes 4

Profiles for Autoscaling

The node removal decision is a balance between the availability and optimization of a resource. To make a better decision, we can choose the autoscaling profile. The profiles available are balanced profile and optimize-utilization profile. The balanced profile is the default one. In order to activate the optimize-utilization profile, use the code as shown below:

gcloud container clusters update CLUSTER_NAME
--autoscaling-profile optimize-utilization

Disruption and Pod Scheduling

Cluster autoscaler considers scheduling and eviction rules on pods when scaling down. As a result, it prevents the autoscaler from deleting a node.

Drawbacks of GKE Cluster Autoscaler

  • The Limited cluster size of 15,000 nodes and 150,000 pods.
  • Cluster autoscaler does not currently support local persistent volumes.
  • During a scale-up event, cluster autoscaler only balances across zones.
  • Custom scheduling with different filters is not possible.
  • The cluster autoscaler cannot completely scale down, sometimes an extra node remains after scaling down.

[Need an answer to a different question? We can be reached with a single mouse click.]

Conclusion

The GKE Cluster Autoscaler tool grows or shrinks a Kubernetes cluster based on the presence of pending pods and node utilization metrics. Here, our Support team went over the GKE Cluster Autoscaler details.

PREVENT YOUR SERVER FROM CRASHING!

Never again lose customers to poor server speed! Let us help you.

Our server experts will monitor & maintain your server 24/7 so that it remains lightning fast and secure.

GET STARTED

0 Comments

Submit a Comment

Your email address will not be published. Required fields are marked *

Never again lose customers to poor
server speed! Let us help you.