From f8a68efe63824d6d957200e3c3cc8ff3beabdaaf Mon Sep 17 00:00:00 2001 From: Julien Francoz Date: Thu, 19 Dec 2024 14:07:40 +0100 Subject: [PATCH] change default cluster-autoscaler to least-waste With the previous default of random, this could lead to start very expansives nodes that the cluster autoscaler does not manage to remove as long as another smaller node is started. --- cluster-autoscaler/FAQ.md | 6 +++--- cluster-autoscaler/main.go | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/cluster-autoscaler/FAQ.md b/cluster-autoscaler/FAQ.md index 0b2524b17fd8..5d5026e05b45 100644 --- a/cluster-autoscaler/FAQ.md +++ b/cluster-autoscaler/FAQ.md @@ -924,7 +924,7 @@ Expanders can be selected by passing the name to the `--expander` flag, i.e. Currently Cluster Autoscaler has 5 expanders: -* `random` - this is the default expander, and should be used when you don't have a particular +* `random` - should be used when you don't have a particular need for the node groups to scale differently. * `most-pods` - selects the node group that would be able to schedule the most pods when scaling @@ -932,7 +932,7 @@ up. This is useful when you are using nodeSelector to make sure certain pods lan Note that this won't cause the autoscaler to select bigger nodes vs. smaller, as it can add multiple smaller nodes at once. -* `least-waste` - selects the node group that will have the least idle CPU (if tied, unused memory) +* `least-waste` - this is the default expander, selects the node group that will have the least idle CPU (if tied, unused memory) after scale-up. This is useful when you have different classes of nodes, for example, high CPU or high memory nodes, and only want to expand those when there are pending pods that need a lot of those resources. * `least-nodes` - selects the node group that will use the least number of nodes after scale-up. This is useful when you want to minimize the number of nodes in the cluster and instead opt for fewer larger nodes. Useful when chained with the `most-pods` expander before it to ensure that the node group selected can fit the most pods on the fewest nodes. @@ -994,7 +994,7 @@ The following startup parameters are supported for cluster autoscaler: | `enable-provisioning-requests` | Whether the clusterautoscaler will be handling the ProvisioningRequest CRs. | | | `enforce-node-group-min-size` | Should CA scale up the node group to the configured min size if needed. | | | `estimator` | Type of resource estimator to be used in scale up. Available values: [binpacking] | "binpacking" | -| `expander` | Type of node group expander to be used in scale up. Available values: [random,most-pods,least-waste,price,priority,grpc]. Specifying multiple values separated by commas will call the expanders in succession until there is only one option remaining. Ties still existing after this process are broken randomly. | "random" | +| `expander` | Type of node group expander to be used in scale up. Available values: [random,most-pods,least-waste,price,priority,grpc]. Specifying multiple values separated by commas will call the expanders in succession until there is only one option remaining. Ties still existing after this process are broken randomly. | "least-waste" | | `expendable-pods-priority-cutoff` | Pods with priority below cutoff will be expendable. They can be killed without any consideration during scale down and they don't cause scale up. Pods with null priority (PodPriority disabled) are non expendable. | -10 | | `feature-gates` | A set of key=value pairs that describe feature gates for alpha/experimental features. Options are: | | | `force-delete-unregistered-nodes` | Whether to enable force deletion of long unregistered nodes, regardless of the min size of the node group the belong to. | | diff --git a/cluster-autoscaler/main.go b/cluster-autoscaler/main.go index 3395b26ac6e7..652ebcf82b32 100644 --- a/cluster-autoscaler/main.go +++ b/cluster-autoscaler/main.go @@ -196,7 +196,7 @@ var ( estimatorFlag = flag.String("estimator", estimator.BinpackingEstimatorName, "Type of resource estimator to be used in scale up. Available values: ["+strings.Join(estimator.AvailableEstimators, ",")+"]") - expanderFlag = flag.String("expander", expander.RandomExpanderName, "Type of node group expander to be used in scale up. Available values: ["+strings.Join(expander.AvailableExpanders, ",")+"]. Specifying multiple values separated by commas will call the expanders in succession until there is only one option remaining. Ties still existing after this process are broken randomly.") + expanderFlag = flag.String("expander", expander.LeastWasteExpanderName, "Type of node group expander to be used in scale up. Available values: ["+strings.Join(expander.AvailableExpanders, ",")+"]. Specifying multiple values separated by commas will call the expanders in succession until there is only one option remaining. Ties still existing after this process are broken randomly.") grpcExpanderCert = flag.String("grpc-expander-cert", "", "Path to cert used by gRPC server over TLS") grpcExpanderURL = flag.String("grpc-expander-url", "", "URL to reach gRPC expander server.")