Search code examples
kubernetesgoogle-kubernetes-engineautoscalinghorizontal-pod-autoscaling

GKE Autoscaling: How do I tell the autoscaler to remove older pods first? (FILO insteado FIFO)


There is a small memory leak in our application. For certain business reasons we do not have the resources to fix this memory leak. Instead, it would be better if our pods were deleted or scaled out after a certain period.

Rather than debugging this memory leak would it be possible to change the Google Kubernetes Engine autoscaling profile to scale down by removing older pods instead of newer pods first? Essentially, I am looking for a "First In Last Out" method of scaling down pods instead of a "First In First Out" method, which is what GKE currently uses (from my understanding) when autoscaling.

Is this possible? I'm not finding anything about this in the documentation. Thank you!


Solution

  • Scale-down in cluster-autoscaler isn't really either of those. It's looking for nodes with low utilization and simulating if those pods were evicted would the cluster have enough capacity. In practice FIFO or close to it is common because newer pods end up on newer nodes and those have less utilization. But you can use tools like Descheduler to help balance stuff out a bit.