GKE cluster suddenly not autoscaling nodepool
System Design practice on Codemia
Work through 120+ system design problems with detailed solutions, from rate limiters to multi-region storage.
Understanding GKE Cluster Node Pool Autoscaling Issues
Google Kubernetes Engine (GKE) is known for its powerful and dynamic autoscaling capabilities, which help manage workloads efficiently by scaling the number of nodes in a cluster as per demand. However, users might occasionally encounter situations where the autoscaling feature does not operate as expected. In this article, we delve into possible reasons and troubleshoot scenarios when a GKE cluster node pool suddenly stops autoscaling.
How GKE Autoscaling Works
Before diving into issues, it's critical to understand how GKE's Cluster Autoscaler operates. GKE autoscaling can adjust the size of the cluster, typically based on the following:
- Pod Resource Requests: Scales nodes based on the resource requests of pods that cannot be scheduled due to insufficient resources.
- Predefined Min/Max Nodes: Adheres to the minimum and maximum node limits defined in the node pool configuration.
- Scale Up/Down Events: Automatically adds nodes when resources are scarce and removes nodes when they are underutilized.
Possible Causes for Autoscaling Failure
- Insufficient Resource Requests:
- Pods that do not specify resource requests might not trigger scaling. It's crucial that CPU and memory requests are appropriately defined.
- Imbalanced Resource Requests:
- If requests are skewed, the scheduler might struggle to place pods efficiently even if the autoscaler adds nodes.
- Node Pool Configuration Issues:
- The min and max node limits might have been configured inaccurately.
- Pod Affinity/Anti-Affinity Rules:
- Strict rules can prevent pods from being scheduled on newly scaled nodes.
- Resource Quotas and Limits:
- The project or cluster could be hitting set quotas, preventing further scaling.
- Temporary API Issues:
- GCP might occasionally experience API service issues affecting autoscaler operations.
- Autoscaler Stabilization:
- Autoscaler has built-in mechanisms to avoid flapping which might delay scaling.
Troubleshooting Steps
- Review Autoscaler Logs:
- Use
kubectl logsto review the autoscale controller manager logs to identify underlying issues.
- Check PodResource Requests:
- Verify that pods have appropriate CPU and memory requests set using
kubectl describe pod.
- Inspect Node Pool Configurations:
- Confirm that min/max settings in the node pool configuration align with expected scaling behavior.
- Evaluate Cluster Resource Utilization:
- Monitor usage with commands like
kubectl top nodes/podsto determine if resources are accurately represented.
- Review Quotas:
- Check the GCP Console quotas section for the project to ensure that limits are not being breached.
- Test with a Scale Deployment:
- Manually scale a deployment to observe if new nodes are added appropriately.
- Consult GCP Status Dashboard:
- Investigate potential API issues or disruptions on the GCP Status Dashboard.
Example Scenario
Consider a scenario where a GKE cluster houses a critical application requiring occasional high bursts of processing capacity. The node pool expects to scale from 3 to a maximum of 10 nodes. However, upon increased load, no scaling occurs. Here's an illustration of possible investigations:
- Resource Requests: Ensure that pods defining the microservices have accurate resource requests set:
- name: service
- Node Pool Settings: Verify the node pool configuration:
- Quotas: Use the following command to check relevant quotas:
Related reading
- GKE does not scale to/from 0 when autoscaling enabled
- GKE Google Managed Certificate with DNS authorization
- GKE node with modprobe
- GKE right way to mount same PV on multiple pods
- Google app engine or amazon web services
- Google Cloud - Compute Engine VS Machine Learning
- Golang service running on Kubernetes EKS gets OOM killed high RES memory value, low runtime.Memstats.Alloc value
- Google Cloud Kubernetes accessing private Docker Hub hosted images

System Design Fundamentals
Build a strong foundation in designing scalable, reliable distributed systems.
View the courseTrack what you have practised
A free account saves your progress, solutions and study plan across every problem on Codemia.
System Design practice on Codemia
Work through 120+ system design problems with detailed solutions, from rate limiters to multi-region storage.