Home > Enterprise >  What is the effect of setting the number of nodes in combination with autoscaler in GKE?
What is the effect of setting the number of nodes in combination with autoscaler in GKE?

Time:09-21

In the Google documentation there is the following example:

https://cloud.google.com/kubernetes-engine/docs/concepts/cluster-autoscaler#autoscaling_limits

Autoscaling limits

You can set the minimum and maximum number of nodes for the cluster autoscaler to use when scaling a node pool. Use the --min-nodes and --max-nodes flags to set the minimum and maximum number of nodes per zone

Starting in GKE version 1.24, you can use the --total-min-nodes and --total-max-nodes flags for new clusters. These flags set the minimum and maximum number of the total number of nodes in the node pool across all zones.

Min and max nodes example

The following command creates an autoscaling multi-zonal cluster with six nodes across three zones initially, with a minimum of one node per zone and a maximum of 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

In this example, the total size of the cluster can be between three and twelve nodes, spread across the three zones. If one of the zones fails, the total size of the cluster can be between two and eight nodes.

So my question is:

What is the effect of setting --num-nodes=2 in this example? Does it matter if I set --num-nodes=1 or --num-nodes=3?

CodePudding user response:

--num-nodes=2 represents the number of virtual machine in your kubernetes cluster, setting it to 1 or 3 nodes will matter depending on what will be the usage of your application on your kubernetes cluster, also from the example above --enable-autoscaling --min-nodes=1 --max-nodes=4 you can change the value of the nodes depending on the behavior of your application if it will be needing more resource.

  • Related