From 986d62fb96445339076023ec5c1487e6b403c900 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 73105a4fd300..b006ad988dee 100644 --- a/cluster-autoscaler/FAQ.md +++ b/cluster-autoscaler/FAQ.md @@ -33,6 +33,7 @@ this document: * [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/disable eviction for a specific DaemonSet](#how-can-i-enabledisable-eviction-for-a-specific-daemonset) + * [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) @@ -459,6 +460,17 @@ sufficient to modify the pod spec in the DaemonSet object. This annotation has no effect on pods that are not a part of any DaemonSet. +### 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 @@ -735,6 +747,7 @@ The following startup parameters are supported for cluster autoscaler: | `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 | `daemonset-eviction-for-empty-nodes` | Whether DaemonSet pods will be gracefully terminated from empty nodes | false | `daemonset-eviction-for-occupied-nodes` | Whether DaemonSet pods will be gracefully terminated from non-empty nodes | true +| `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 e25f2a43a83e..0c067bf71818 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" @@ -392,7 +393,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)