Scaling down GKE to near zero during non-office hours

Hi all,

I have a GKE cluster with Apigee hybrid runtime installed. I’d like to be able to scale it down to near zero during non-office hours for cost optimization purposes. I do not need Apigee services to be functional during this period.

I’ve read [1]. However, it’s only scaling to a minimum threshold where the services can still function.

Can I simply set the node pool size to 1 and allow GKE scheduler to do its job?

Thanks.

[1] https://cloud.google.com/architecture/reducing-costs-by-scaling-down-gke-off-hours

Take a look at the Cluster Autoscaler feature in GKE. If you run GKE version 1.22 or later, a minimum of zero nodes can be configured.

@grobledo I’m wondering if you could weigh in on why I’m not seeing nodes stay at 0 when scaling down to 0. Running gcloud container clusters resize jqgke --node-pool jqnodes --num-nodes 0 --region us-west1 -q on a cluster at version 1.22.10 will start terminating existing nodes, but 3 others are started and added to the node pool.

Node version
1.22.10-gke.600

Size
Number of nodes: 5 total (0-3 per zone)
Autoscaling: On (0-3 nodes per zone)
Node zones

  • us-west1-b
  • us-west1-c
  • us-west1-a

In the autoscaler logs, I see messages like:

{
  "decision": {
    "decideTime": "1660927270",
    "eventId": "d91e5a26-fb0d-4f9d-94c6-a2cebd7d48d7",
    "scaleUp": {
      "triggeringPodsTotalCount": 23,
      "triggeringPods": [
        <list of pods>
      ],
      "increasedMigs": [
        {
          "mig": {
            "zone": "us-west1-a",
            "nodepool": "<node pool>",
            "name": "<node group>"
          },
          "requestedNodes": 1
        }
      ]
    }
  }
}