kubernetes / autoscaler

Autoscaling components for Kubernetes
Apache License 2.0
8.07k stars 3.97k forks source link

Cluster autoscaler 1.29.0 minSize not respected #6564

Closed schlichtanders closed 6 months ago

schlichtanders commented 8 months ago

Which component are you using?: cluster-autoscaler

What version of the component are you using?: 1.29.0

Component version:

What k8s version are you using (kubectl version)?:

kubectl version Output
$ kubectl version

Client Version: v1.28.4
Kustomize Version: v5.0.4-0.20230601165947-6ce0bf390ce3
Server Version: v1.29.1+k3s2

What environment is this in?:

Hetzner

What did you expect to happen?: When configuring autoscaler to have minSize, I expect the nodegroup to get at least as many nodes.

What happened instead?:

It stays at 0 nodes.

How to reproduce it (as minimally and precisely as possible):

I already had a cluster where I changed the minimum from 0 to 1 and nothing happens. The easiest way to set a cluster on hetzner is to use kube-hetzner

Anything else we need to know?:

The logs only show logs about down scaling tries.

apricote commented 7 months ago

There is a flag --enforce-node-group-min-size that should do what you are looking for. By default, cluster-autoscaler only adds Nodes when necessary.

See flags and there descriptions in https://github.com/kubernetes/autoscaler/blob/master/cluster-autoscaler/FAQ.md#what-are-the-parameters-to-ca

apricote commented 6 months ago

@schlichtanders Did the mentioned flag solve your issue?

schlichtanders commented 6 months ago

Thank you apricote for pinging. The issue indeed got resolved, but if I am right, it was a more complex problem where the upscaling failed because the deployment of the autoscaler failed. Thank you for your help and hope that it may help others in similar situations as well.

Closing as this is no longer a problem for me.