Skip to content

Commit

Permalink
Support scaling up node groups to the configured min size if needed
Browse files Browse the repository at this point in the history
  • Loading branch information
liuxintong committed Oct 6, 2022
1 parent ab08e9a commit 1ea3671
Show file tree
Hide file tree
Showing 9 changed files with 889 additions and 359 deletions.
10 changes: 9 additions & 1 deletion cluster-autoscaler/FAQ.md
Original file line number Diff line number Diff line change
Expand Up @@ -720,6 +720,7 @@ The following startup parameters are supported for cluster autoscaler:
| `kubeconfig` | Path to kubeconfig file with authorization and API Server location information | ""
| `cloud-config` | The path to the cloud provider configuration file. Empty string for no configuration file | ""
| `namespace` | Namespace in which cluster-autoscaler run | "kube-system"
| `scale-up-node-group-to-min-size-enabled` | Should CA scale up the node group to the configured min size if needed | false
| `scale-down-enabled` | Should CA scale down the cluster | true
| `scale-down-delay-after-add` | How long after scale up that scale down evaluation resumes | 10 minutes
| `scale-down-delay-after-delete` | How long after node deletion that scale down evaluation resumes, defaults to scan-interval | scan-interval
Expand Down Expand Up @@ -933,7 +934,14 @@ Events:
```
### My cluster is below minimum / above maximum number of nodes, but CA did not fix that! Why?

Cluster Autoscaler will not scale the cluster beyond these limits, but does not enforce them. If your cluster is below the minimum number of nodes configured for Cluster Autoscaler, it will be scaled up *only* in presence of unschedulable pods.
Cluster Autoscaler will not scale the cluster beyond these limits, but some other external factors could make this happen. Here are some common scenarios.
* Existing nodes were deleted from K8s and the cloud provider, which could cause the cluster fell below the minimum number of nodes.
* New nodes were added directly to the cloud provider, which could cause the cluster exceeded the maximum number of nodes.
* Cluster Autoscaler was turned on in the middle of the cluster lifecycle, and the initial number of nodes might beyond these limits.

By default, Cluster Autoscaler does not enforce the node group size. If your cluster is below the minimum number of nodes configured for CA, it will be scaled up *only* in presence of unschedulable pods. On the other hand, if your cluster is above the minimum number of nodes configured for CA, it will be scaled down *only* if it has unneeded nodes.

Starting with CA 1.26.0, a new flag `--scale-up-to-node-group-min-size-enabled` was introduced to enforce the node group minimum size. For node groups with fewer nodes than the configuration, CA will scale them up to the minimum number of nodes. To enable this feature, please set it to `true` in the command.

### What happens in scale-up when I have no more quota in the cloud provider?

Expand Down
2 changes: 2 additions & 0 deletions cluster-autoscaler/config/autoscaling_options.go
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,8 @@ type AutoscalingOptions struct {
CloudProviderName string
// NodeGroups is the list of node groups a.k.a autoscaling targets
NodeGroups []string
// ScaleUpToNodeGroupMinSizeEnabled is used to allow CA to scale up the node group to the configured min size if needed.
ScaleUpToNodeGroupMinSizeEnabled bool
// ScaleDownEnabled is used to allow CA to scale down the cluster
ScaleDownEnabled bool
// ScaleDownDelayAfterAdd sets the duration from the last scale up to the time when CA starts to check scale down options
Expand Down
Loading

0 comments on commit 1ea3671

Please sign in to comment.