Customize kube-scheduler parameters

更新时间:
复制 MD 格式

Modify the custom parameters of kube-scheduler to control Pod scheduling behavior, such as enabling the binpack strategy or load-aware scheduling.

Prerequisites

An ACK Pro cluster, ACK Edge Pro cluster, ACK Lingjun cluster, or ACK Serverless Pro cluster of version 1.20 or later. To upgrade a cluster, see Manually upgrade a cluster.

Limitations

For ACK Pro clusters and ACK Edge Pro clusters, the scheduler must meet the following version requirements.

Note

All ACK Serverless Pro clusters and ACK Lingjun clusters that have kube-scheduler installed support custom parameters.

Kubernetes version

Scheduler version that supports custom parameters

1.28 or later

All versions are supported.

1.26

v1.26.3-aliyun-6.8.7.5a563072 or later

1.24

v1.24.6-ack-3.1 or later

1.22

v1.22.15-ack-2.0 or later

1.20

v1.20.11-9.0-bcaa6001-aliyun or later

Procedure

  1. Log on to the ACK console. In the left navigation pane, click Clusters.

  2. On the Clusters page, click the name of your cluster. In the left navigation pane, click Components and Add-ons.

  3. On the Core Components tab, find the kube-scheduler component and click Configuration in the lower-right corner of the card. In the dialog box that appears, configure the parameters as prompted.

    The supported features and custom parameters vary by scheduler version. For more information about the features supported by different scheduler versions, see kube-scheduler. The following table describes the custom parameters and their usage.

    Parameter

    Description

    Type

    Valid values (range)

    Default

    Enable Virtual Node-based Pod Scheduling

    If enabled, Pods scheduled on virtual nodes also adhere to scheduling semantics such as node affinity and anti-affinity (spreading).

    bool

    • true

    • false

    true

    podMaxBackoffSeconds

    The maximum backoff time in seconds after a Pod scheduling attempt fails. The interval between retries will not exceed this value.

    int

    [1,100000]

    10

    Preferably Use Bin Packing During Pod Scheduling

    Enables or disables the binpack strategy.

    For a configuration example, see Custom binpack parameters.

    bool

    • false

    • true

    false

    binpackPluginWeight

    The weight of the binpack plugin relative to other scoring plugins. This parameter takes effect only when Preferably Use Bin Packing During Pod Scheduling is enabled.

    int

    [1,100000]

    100

    binpackResourceWeight

    The weight of each resource type used by the binpack plugin for scoring. This parameter takes effect only when Preferably Use Bin Packing During Pod Scheduling is enabled.

    • resourceName: string

    • resourceWeight: int

    • resourceName can contain only letters, digits, periods (.), forward slashes (/), and hyphens (-).

    • resourceWeight must be an integer in the range [1, 10000].

    • cpu:1

    • memory:1

    scorePluginWeights

    The weights of various scoring plugins.

    Note

    The weight of the NodeResourceFit plugin conflicts with the binpack plugin. If you enable Preferably Use Bin Packing During Pod Scheduling, do not configure the weight for the NodeResourceFit plugin in this parameter.

    • plugin: string

    • weight: int

    • plugin: Only plugins from the allowed plugin list are supported.

    • weight must be an integer in the range [1, 10000].

    • plugin: NodeAffinity

    • weight: 100

    percentageOfNodesToScore

    The percentage of feasible nodes to evaluate during scoring.

    A value of 0 indicates that the scheduler scores a default percentage of nodes determined by the cluster size. This value ranges from 5% to 50%.

    int

    [0,100]

    0

    Enable Scoring for Shared GPU Plugin

    When you use the GPU sharing feature (which requires the AI suite), the scheduler prioritizes GPUs with higher requests for memory and computing resources when scheduling GPU Pods.

    bool

    • false

    • true

    true

    Enable Load-aware Scoring (loadAwareResourceWeight)

    Enables load-aware scheduling. This feature requires you to install the ack-koordinator component.

    bool

    • false

    • true

    false

    loadAwareThreshold

    For node filtering, this parameter specifies the threshold for each resource type.

    A list that consists of a resourceName and a threshold.

    • resourceName: Supports cpu and memory.

    • threshold: [0,100].

    The default value is empty, which means filtering is disabled.

    • resourceName: cpu

    • threshold: 80

    loadAwareResourceWeight

    For node scoring, this parameter specifies the weight for each resource type and takes effect only if you select Enable Load-aware Scoring.

    A list that consists of a resourceName and a resourceWeight.

    • resourceName: Validated by schema. Only cpu or memory is supported.

    • resourceWeight: An integer in the range [1, 100].

    • cpu=1

    • memory=1

    loadAwareAggregatedUsageAggregationType

    The aggregation type for load metrics:

    • avg: Average.

    • p50: 50th percentile (median).

    • p90, p95, p99: The 90th, 95th, and 99th percentiles.

    enum

    • avg

    • p50

    • p90

    • p95

    • p99

    avg

    preemptionAlgorithm

    ACK Scheduler uses resource simulation to determine whether to evict low-priority Pods to ensure that high-priority Pods start quickly. The following strategies are supported:

    • Default: Kubernetes community-standard preemption.

    • ElasticQuota: Preemption based on ElasticQuotaTree.

    • Auto: Adjusts the preemption policy based on the cluster configuration.

    • None: Disables preemption.

    For more information, see Enable preemption.

    enum

    • Default

    • ElasticQuota

    • Auto

    • None

    Auto

    enableReservation

    Enables the resource reservation feature.

    boolean

    • true

    • false

    false

    featureGates

    The feature gates to enable for the scheduler. For the feature gates supported in different versions, see the official Kubernetes documentation for kube-scheduler.

    string

    Not applicable.

    Same as the feature gates in open source Kubernetes.

The following section provides examples of how to use custom parameters.

Custom binpack parameters

Comparison of binpack and spread strategies

Aspect

Binpack strategy

Spread strategy

Scheduling policy

  • Prioritizes scheduling Pods to nodes with higher resource utilization.

  • Multiple Pods are more likely to share the same node.

  • Prioritizes scheduling Pods to nodes with lower resource utilization.

  • Multiple Pods are more likely to be spread across different nodes.

Characteristics

Reduces resource fragmentation on nodes.

  • The spread strategy is the default resource scheduling policy in Kubernetes.

  • Distributes cluster resources relatively evenly across all nodes.

  • Can lead to more resource fragmentation on individual nodes.

Use cases

Scenarios that require improved node utilization.

Scenarios that require high node availability.

Configuring custom binpack parameters

To use the binpack strategy, enable Preferably Use Bin Packing During Pod Scheduling. You can also set the plugin's weight. A higher weight increases the likelihood that Pods will be packed onto the same node. Additionally, you can specify the resource names and their corresponding weights for the binpack plugin to consider during scoring. A higher resource weight gives that resource type more influence on the scheduling decision.

On the Add-ons page, go to the Core Components tab, find the kube-scheduler component, and click Configuration. In the dialog box, configure the binpack-related parameters.

Parameter

Example and description

Preferably Use Bin Packing During Pod Scheduling

Turn on the switch.

binpackPluginWeight

The default value is sufficient for most cases. If the binpack strategy does not take effect after you enable it, you can increase the weight, for example, to 200. For more information, see binpack weight.

Binpack strategies for different resources

For a detailed configuration example, see Enabling bin packing using MostAllocated strategy.

  • The name and weight in scoringStrategy:resources represent the relative importance of different resources for binpack scoring.

  • The name and weight in scoringStrategy:resources correspond to the resourceName and resourceWeight parameters in the console.

If you enable Preferably Use Bin Packing During Pod Scheduling but do not configure any resourceName or resourceWeight in binpackResourceWeight, the system applies the default binpack settings for CPU and memory. This has the same effect as the following configuration.

Default configuration: resourceName is cpu and resourceWeight is 1; resourceName is memory and resourceWeight is 1.

Related documents

We recommend enabling load-aware scheduling to schedule Pods based on the actual resource usage of nodes instead of their requested resources. For more information, see Use load-aware scheduling.