From 606f44dab9f917776ee2cd5fcfaa92008c0e9078 Mon Sep 17 00:00:00 2001 From: ialidzhikov Date: Sun, 19 Dec 2021 15:38:17 +0200 Subject: [PATCH] Add `--feature-gates` flag to support scale up on volume limits (CSI migration enabled) Signed-off-by: ialidzhikov --- cluster-autoscaler/FAQ.md | 13 +++++++++++++ cluster-autoscaler/main.go | 3 +++ 2 files changed, 16 insertions(+) diff --git a/cluster-autoscaler/FAQ.md b/cluster-autoscaler/FAQ.md index 9fa2d9cd7bef..681c7899a603 100644 --- a/cluster-autoscaler/FAQ.md +++ b/cluster-autoscaler/FAQ.md @@ -32,6 +32,7 @@ this document: * [How can I scale a node group to 0?](#how-can-i-scale-a-node-group-to-0) * [How can I prevent Cluster Autoscaler from scaling down a particular node?](#how-can-i-prevent-cluster-autoscaler-from-scaling-down-a-particular-node) * [How can I configure overprovisioning with Cluster Autoscaler?](#how-can-i-configure-overprovisioning-with-cluster-autoscaler) + * [How can I enable Cluster Autoscaler to scale up when Node's max volume count is exceeded (CSI migration enabled)?](#how-can-i-enable-cluster-autoscaler-to-scale-up-when-nodes-max-volume-count-is-exceeded-csi-migration-enabled) * [Internals](#internals) * [Are all of the mentioned heuristics and timings final?](#are-all-of-the-mentioned-heuristics-and-timings-final) * [How does scale-up work?](#how-does-scale-up-work) @@ -434,6 +435,17 @@ spec: serviceAccountName: cluster-proportional-autoscaler-service-account ``` +### How can I enable Cluster Autoscaler to scale up when Node's max volume count is exceeded (CSI migration enabled)? + +Kubernetes scheduler will fail to schedule a Pod to a Node if the Node's max volume count is exceeded. In such case to enable Cluster Autoscaler to scale up in a Kubernetes cluster with [CSI migration](https://github.com/kubernetes/enhancements/blob/master/keps/sig-storage/625-csi-migration/README.md) enabled, the appropriate CSI related feature gates have to be specified for the Cluster Autoscaler (if the corresponding feature gates are not enabled by default). + +For example: +``` +--feature-gates=CSIMigration=true,CSIMigration{Provdider}=true,InTreePlugin{Provider}Unregister=true +``` + +For a complete list of the feature gates and their default values per Kubernetes versions, refer to the [Feature Gates documentation](https://kubernetes.io/docs/reference/command-line-tools-reference/feature-gates/). + **************** # Internals @@ -683,6 +695,7 @@ The following startup parameters are supported for cluster autoscaler: | `skip-nodes-with-system-pods` | If true cluster autoscaler will never delete nodes with pods from kube-system (except for DaemonSet or mirror pods) | true | `skip-nodes-with-local-storage`| If true cluster autoscaler will never delete nodes with pods with local storage, e.g. EmptyDir or HostPath | true | `min-replica-count` | Minimum number or replicas that a replica set or replication controller should have to allow their pods deletion in scale down | 0 +| `feature-gates` | A set of key=value pairs that describe feature gates for alpha/experimental features. | "" # Troubleshooting: diff --git a/cluster-autoscaler/main.go b/cluster-autoscaler/main.go index 530c9f730c3e..d6316c051f87 100644 --- a/cluster-autoscaler/main.go +++ b/cluster-autoscaler/main.go @@ -34,6 +34,7 @@ import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apiserver/pkg/server/mux" "k8s.io/apiserver/pkg/server/routes" + utilfeature "k8s.io/apiserver/pkg/util/feature" "k8s.io/autoscaler/cluster-autoscaler/cloudprovider" cloudBuilder "k8s.io/autoscaler/cluster-autoscaler/cloudprovider/builder" "k8s.io/autoscaler/cluster-autoscaler/config" @@ -385,7 +386,9 @@ func main() { leaderElection.LeaderElect = true options.BindLeaderElectionFlags(&leaderElection, pflag.CommandLine) + utilfeature.DefaultMutableFeatureGate.AddFlag(pflag.CommandLine) kube_flag.InitFlags() + healthCheck := metrics.NewHealthCheck(*maxInactivityTimeFlag, *maxFailingTimeFlag) klog.V(1).Infof("Cluster Autoscaler %s", version.ClusterAutoscalerVersion)