Configuring the cluster autoscaler

Voir en Markdown

Objective

OVHcloud Managed Kubernetes service provides you Kubernetes clusters without the hassle of installing or operating them.

During the day-to-day life of your cluster, you may want to dynamically adjust the size of your cluster to accommodate to your workloads. The cluster autoscaler simplifies the task by scaling up or down your OVHcloud Managed Kubernetes cluster to meet the demand of your workloads.

This guide follows up the Using the cluster autoscaler guide, and it will cover a description of the cluster autoscaler configuration.

Requirements

Instructions

Cluster autoscaler configuration

When the autoscaler is enabled on a node pool, it uses a default configuration.

Here you have a description of the parameters used in the autoscaler configuration, and their default value:

SettingDescriptionDefault
scan-intervalHow often the cluster is reevaluated for scale up or down10 seconds
scale-down-delay-after-addHow long after a scale-up before scale-down evaluation resumes10 minutes
scale-down-delay-after-deleteHow long after node deletion before scale-down evaluation resumesscan-interval
scale-down-delay-after-failureHow long after a scale-down failure before scale-down evaluation resumes3 minutes
scale-down-unneeded-timeHow long a node must be unneeded before it is eligible for scale-down10 minutes
scale-down-unready-timeHow long an unready node must be unneeded before it is eligible for scale-down20 minutes
scale-down-utilization-thresholdUtilization ratio (requested resources / capacity) below which a node is considered for scale-down0.5
max-graceful-termination-secMax seconds to wait for pod termination when scaling down a node600 seconds
balance-similar-node-groupsBalance node counts across pools sharing the same instance type and labelsfalse
expanderNode pool selection strategy for scale-up: most-pods, random, least-waste, priorityrandom
skip-nodes-with-local-storageNever delete nodes with pods using local storage (EmptyDir or HostPath)false
skip-nodes-with-system-podsNever delete nodes with kube-system pods (except DaemonSets and mirror pods)false
max-empty-bulk-deleteMax number of empty nodes that can be deleted simultaneously10 nodes
new-pod-scale-up-delayMin age of an unscheduled pod before the autoscaler acts on it0 seconds
max-total-unready-percentageMax percentage of unready nodes; autoscaler halts if exceeded45%
max-node-provision-timeMax time the autoscaler waits for a node to be provisioned15 minutes
ok-total-unready-countNumber of allowed unready nodes regardless of the percentage threshold3 nodes

You can get more information on those parameters on the Kubernetes autoscaler documentation.

If you consider we should reevaluate the default value and/or prioritize the possible customization of one of those parameters, you are welcome to create an issue on our Public roadmap.

Configuring the autoscaler

The easiest way to enable the autoscaler is using the Kubernetes API, for example using kubectl.

Using Kubernetes API

When the autoscaler is enabled on a node pool, it uses a default configuration.

To list node pools, you can use:

kubectl get nodepools

You can change several parameters values through kubectl command:

kubectl patch nodepool <your_nodepool_name> --type="merge" --patch='{"spec": {"autoscaling": {"scaleDownUnneededTimeSeconds": <a_value>, "scaleDownUnreadyTimeSeconds": <another_value>, "scaleDownUtilizationThreshold": "<and_another_one>"}}}'

In my example cluster:

$ kubectl get nodepool nodepool-b2-7 -o json | jq .spec
{
  "antiAffinity": false,
  "autoscale": true,
  "autoscaling": {
    "scaleDownUnneededTimeSeconds": 600,
    "scaleDownUnreadyTimeSeconds": 1200,
    "scaleDownUtilizationThreshold": "0.5"
  },
  "desiredNodes": 3,
  "flavor": "b2-7",
  "maxNodes": 100,
  "minNodes": 0,
  "monthlyBilled": false
}
$ kubectl patch nodepool nodepool-b2-7 --type="merge" --patch='{"spec": {"autoscaling": {"scaleDownUnneededTimeSeconds": 900, "scaleDownUnreadyTimeSeconds": 1500, "scaleDownUtilizationThreshold": "0.7"}}}'
nodepool.kube.cloud.ovh.com/nodepool-b2-7 patched
$ kubectl get nodepool nodepool-b2-7 -o json | jq .spec
{
  "antiAffinity": false,
  "autoscale": true,
  "autoscaling": {
    "scaleDownUnneededTimeSeconds": 900,
    "scaleDownUnreadyTimeSeconds": 1500,
    "scaleDownUtilizationThreshold": "0.7"
  },
  "desiredNodes": 3,
  "flavor": "b2-7",
  "maxNodes": 100,
  "minNodes": 0,
  "monthlyBilled": false
}

For the moment, only these following parameters are editable:

  • autoscale
  • autoscaling
  • desiredNodes
  • minNodes
  • maxNodes

If you consider that we should prioritize the possible customization of other autoscaling parameters, you are welcome to create an issue on our Public roadmap.

Go further

To have an overview of OVHcloud Managed Kubernetes service, you can go to the OVHcloud Managed Kubernetes page.

Otherwise to skip it and learn more about using your Kubernetes cluster the practical way, we invite you to look at our tutorials .

  • For training or technical assistance implementing our solutions, contact your sales representative or visit our Professional Services page to request a quote and have your project analyzed by our experts.

  • Join our community of users.

Cette page vous a-t-elle aidé ?