Compute
Elastic Cloud Server
Huawei Cloud Flexus
Bare Metal Server
Auto Scaling
Image Management Service
Dedicated Host
FunctionGraph
Cloud Phone Host
Huawei Cloud EulerOS
Networking
Virtual Private Cloud
Elastic IP
Elastic Load Balance
NAT Gateway
Direct Connect
Virtual Private Network
VPC Endpoint
Cloud Connect
Enterprise Router
Enterprise Switch
Global Accelerator
Management & Governance
Cloud Eye
Identity and Access Management
Cloud Trace Service
Resource Formation Service
Tag Management Service
Log Tank Service
Config
OneAccess
Resource Access Manager
Simple Message Notification
Application Performance Management
Application Operations Management
Organizations
Optimization Advisor
IAM Identity Center
Cloud Operations Center
Resource Governance Center
Migration
Server Migration Service
Object Storage Migration Service
Cloud Data Migration
Migration Center
Cloud Ecosystem
KooGallery
Partner Center
User Support
My Account
Billing Center
Cost Center
Resource Center
Enterprise Management
Service Tickets
HUAWEI CLOUD (International) FAQs
ICP Filing
Support Plans
My Credentials
Customer Operation Capabilities
Partner Support Plans
Professional Services
Analytics
MapReduce Service
Data Lake Insight
CloudTable Service
Cloud Search Service
Data Lake Visualization
Data Ingestion Service
GaussDB(DWS)
DataArts Studio
Data Lake Factory
DataArts Lake Formation
IoT
IoT Device Access
Others
Product Pricing Details
System Permissions
Console Quick Start
Common FAQs
Instructions for Associating with a HUAWEI CLOUD Partner
Message Center
Security & Compliance
Security Technologies and Applications
Web Application Firewall
Host Security Service
Cloud Firewall
SecMaster
Anti-DDoS Service
Data Encryption Workshop
Database Security Service
Cloud Bastion Host
Data Security Center
Cloud Certificate Manager
Edge Security
Situation Awareness
Managed Threat Detection
Blockchain
Blockchain Service
Web3 Node Engine Service
Media Services
Media Processing Center
Video On Demand
Live
SparkRTC
MetaStudio
Storage
Object Storage Service
Elastic Volume Service
Cloud Backup and Recovery
Storage Disaster Recovery Service
Scalable File Service Turbo
Scalable File Service
Volume Backup Service
Cloud Server Backup Service
Data Express Service
Dedicated Distributed Storage Service
Containers
Cloud Container Engine
SoftWare Repository for Container
Application Service Mesh
Ubiquitous Cloud Native Service
Cloud Container Instance
Databases
Relational Database Service
Document Database Service
Data Admin Service
Data Replication Service
GeminiDB
GaussDB
Distributed Database Middleware
Database and Application Migration UGO
TaurusDB
Middleware
Distributed Cache Service
API Gateway
Distributed Message Service for Kafka
Distributed Message Service for RabbitMQ
Distributed Message Service for RocketMQ
Cloud Service Engine
Multi-Site High Availability Service
EventGrid
Dedicated Cloud
Dedicated Computing Cluster
Business Applications
Workspace
ROMA Connect
Message & SMS
Domain Name Service
Edge Data Center Management
Meeting
AI
Face Recognition Service
Graph Engine Service
Content Moderation
Image Recognition
Optical Character Recognition
ModelArts
ImageSearch
Conversational Bot Service
Speech Interaction Service
Huawei HiLens
Video Intelligent Analysis Service
Developer Tools
SDK Developer Guide
API Request Signing Guide
Terraform
Koo Command Line Interface
Content Delivery & Edge Computing
Content Delivery Network
Intelligent EdgeFabric
CloudPond
Intelligent EdgeCloud
Solutions
SAP Cloud
High Performance Computing
Developer Services
ServiceStage
CodeArts
CodeArts PerfTest
CodeArts Req
CodeArts Pipeline
CodeArts Build
CodeArts Deploy
CodeArts Artifact
CodeArts TestPlan
CodeArts Check
CodeArts Repo
Cloud Application Engine
MacroVerse aPaaS
KooMessage
KooPhone
KooDrive

Descheduling

Updated on 2024-10-14 GMT+08:00

Scheduling in a cluster is the process of binding pending pods to nodes, and is performed by a component called kube-scheduler or Volcano Scheduler. The scheduler uses a series of algorithms to compute the optimal node for running pods. However, Kubernetes clusters are dynamic and their state changes over time. For example, if a node needs to be maintained, all pods on the node will be evicted to other nodes. After the maintenance is complete, the evicted pods will not automatically return back to the node because descheduling will not be triggered once a pod is bound to a node. Due to these changes, the load of a cluster may be unbalanced after the cluster runs for a period of time.

CCE has resolved this issue by using Volcano Scheduler to evict pods that do not comply with the configured policy so that pods can be rescheduled. In this way, the cluster load is balanced and resource fragmentation is minimized.

Features

Load-aware Descheduling

During Kubernetes cluster management, over-utilized nodes are due to high CPU or memory usage, which affects the stable running of pods on these nodes and increases the probability of node faults. To dynamically balance the resource usage between nodes in a cluster, a cluster resource view is required based on node monitoring metrics. During cluster management, real-time monitoring can be used to detect issues such as high resource usage on a node, node faults, and excessive number of pods on a node so that the system can take measures promptly, for example, by migrating some pods from an over-utilized node to under-utilized nodes.

Figure 1 Load-aware descheduling

When using this add-on, ensure the highThresholds value is greater than the lowThresholds value. Otherwise, the descheduler cannot work.

  • Appropriately utilized node: a node whose resource usage is greater than or equal to 30% and less than or equal to 80%. The resource usage of appropriately utilized nodes is within the expected range.
  • Over-utilized node: a node whose resource usage is higher than 80%. Some pods will be evicted from over-utilized nodes to reduce its resource usage to be less than or equal to 80%. The descheduler will schedule the evicted pods to under-utilized nodes.
  • Under-utilized node: a node whose resource usage is lower than 30%.

HighNodeUtilization

This policy finds nodes that are under-utilized and evicts pods from the nodes in the hope that these pods will be scheduled compactly into fewer nodes. This policy must be used with the bin packing policy of Volcano Scheduler or the MostAllocated policy of the kube-scheduler scheduler. Thresholds can be configured for CPU and memory.

Prerequisites

Notes and Constraints

  • Pods need to be rescheduled using a scheduler, and no scheduler can label pods or nodes. Therefore, an evicted pod might be rescheduled to the original node.
  • Descheduling does not support anti-affinity between pods. An evicted pod is in anti-affinity relationship with other running pods. Therefore, the scheduler may still schedule the pod back to the node where the pod was evicted from.
  • When configuring load-aware descheduling, you are required to enable load-aware scheduling on Volcano Scheduler. When configuring HighNodeUtilization, you are required to enable bin packing on Volcano Scheduler.

Configuring a Load-aware Descheduling Policy

When configuring a load-aware descheduling policy, do as follows to enable load-aware scheduling on Volcano Scheduler:

  1. Log in to the CCE console and click the cluster name to access the cluster console. In the navigation pane, choose Settings and click the Scheduling tab on the right side of the page. Then, enable load-aware scheduling.
  2. In the navigation pane, choose Add-ons. Locate Volcano Scheduler on the right and click Install or Edit.
  3. In the Parameters area, modify Advanced Settings to configure the load-aware descheduling policy. The following shows a configuration example for Volcano 1.11.21 or later:

    {
      "colocation_enable": "",
      "default_scheduler_conf": {
        "actions": "allocate, backfill, preempt",
        "tiers": [
          {
            "plugins": [
              {
                "name": "priority"
              },
              {
                "enablePreemptable": false,
                "name": "gang"
              },
              {
                "name": "conformance"
              }
            ]
          },
          {
            "plugins": [
              {
                "enablePreemptable": false,
                "name": "drf"
              },
              {
                "name": "predicates"
              },
              {
                "name": "nodeorder"
              },
              {
                "name": "usage",
                "enablePredicate": true,
                "arguments": {
                  "usage.weight": 5,
                  "cpu.weight": 1,
                  "memory.weight": 1,
                  "thresholds": {
                    "cpu": 80,
                    "mem": 80
                  }
                }
              }
            ]
          },
          {
            "plugins": [
              {
                "name": "cce-gpu-topology-predicate"
              },
              {
                "name": "cce-gpu-topology-priority"
              },
              {
                "name": "cce-gpu"
              }
            ]
          },
          {
            "plugins": [
              {
                "name": "nodelocalvolume"
              },
              {
                "name": "nodeemptydirvolume"
              },
              {
                "name": "nodeCSIscheduling"
              },
              {
                "name": "networkresource"
              }
            ]
          }
        ]
      },
      "deschedulerPolicy": {
        "profiles": [
          {
            "name": "ProfileName",
            "pluginConfig": [
              {
                "args": {
                  "ignorePvcPods": true,
                  "nodeFit": true,
                  "priorityThreshold": {
                    "value": 100
                  }
                },
                "name": "DefaultEvictor"
              },
              {
                "args": {
                  "evictableNamespaces": {
                    "exclude": ["kube-system"]
                  },
                  "metrics": {
                    "type": "prometheus_adaptor"
                  },
                  "targetThresholds": {
                    "cpu": 80,
                    "memory": 85
                  },
                  "thresholds": {
                    "cpu": 30,
                    "memory": 30
                  }
                },
                "name": "LoadAware"
              }
            ],
            "plugins": {
              "balance": {
                "enabled": ["LoadAware"]
              }
            }
          }
        ]
      },
      "descheduler_enable": "true",
      "deschedulingInterval": "10m"
    }
    Table 1 Key parameters of a cluster descheduling policy

    Parameter

    Description

    descheduler_enable

    Whether to enable a cluster descheduling policy.

    • true: The cluster descheduling policy is enabled.
    • false: The cluster descheduling policy is disabled.

    deschedulingInterval

    Descheduling period.

    deschedulerPolicy

    Cluster descheduling policy. For details, see Table 2.

    Table 2 deschedulerPolicy parameters

    Parameter

    Description

    profiles.[].plugins.balance.enable.[]

    Descheduling policy for a cluster.

    LoadAware: a load-aware descheduling policy is used.

    profiles.[].pluginConfig.[].name

    Configuration of a load-aware descheduling policy. Options:

    • DefaultEvictor: default eviction policy
    • LoadAware: a load-aware descheduling policy

    profiles.[].pluginConfig.[].args

    Descheduling policy configuration of a cluster.

    • Configurations for the DefaultEvictor policy:
      • ignorePvcPods: whether PVC pods should be ignored or evicted. Value true indicates that the pods are ignored, and value false indicates that the pods are evicted. This configuration does not differentiate PVC types (local PVs, SFS, or EVS).
      • nodeFit: whether to consider the existing scheduling configurations such as node affinity and taint on the node during descheduling. Value true indicates that the existing scheduling configurations will be considered, and value false indicates that those will be ignored.
      • priorityThreshold: priority setting. If the priority of a pod is greater than or equal to the value of this parameter, the pod will not be evicted. Example:
        {
          "value": 100
        }
    • Configurations for the LoadAware policy:
      • evictableNamespaces: namespaces where the eviction policy takes effect. The default value is the namespaces other than kube-system. Example:
        {
          "exclude": ["kube-system"]
        }
      • metrics: how monitoring data is obtained. Either the Custom Metrics API (prometheus_adaptor) or Prometheus can be used.
        For Volcano 1.11.17 and later versions, use Custom Metrics API to obtain monitoring data. The following is an example:
        {
          "type": "prometheus_adaptor"
        }
        For Volcano 1.11.5 to 1.11.16, use Prometheus to obtain monitoring data. You need to enter the IP address of the Prometheus server. The following is an example:
        {
          "address": "http://10.247.119.103:9090",
          "type": "prometheus"
        }
      • targetThresholds: threshold for evicting pods from a node. When the CPU or memory usage of a node is greater than the threshold, the pods on the node will be evicted. Example:
        {
          "cpu": 60,
          "memory": 65
        }
      • thresholds: threshold for a node to run pods. If the node value is less than the threshold, the node allows evicted pods to run. Example:
        {
          "cpu": 30,
          "memory": 30
        }

  4. Click OK.

Configuring a HighNodeUtilization Policy

When configuring a HighNodeUtilization policy, do as follows to enable the bin packing policy on Volcano Scheduler:

  1. Log in to the CCE console and click the cluster name to access the cluster console. In the navigation pane, choose Settings and click the Scheduling tab on the right side of the page. Then, enable bin packing. For details, see Bin Packing.
  2. In the navigation pane, choose Add-ons. Locate Volcano Scheduler on the right and click Install or Edit.
  3. In the Parameters area, modify Advanced Settings to configure the HighNodeUtilization policy.

    {
      "colocation_enable": "",
      "default_scheduler_conf": {
        "actions": "allocate, backfill, preempt",
        "tiers": [
          {
            "plugins": [
              {
                "name": "priority"
              },
              {
                "enablePreemptable": false,
                "name": "gang"
              },
              {
                "name": "conformance"
              },
              {
                "arguments": {
                  "binpack.weight": 5
                },
                "name": "binpack"
              }
            ]
          },
          {
            "plugins": [
              {
                "enablePreemptable": false,
                "name": "drf"
              },
              {
                "name": "predicates"
              },
              {
                "name": "nodeorder"
              }
            ]
          },
          {
            "plugins": [
              {
                "name": "cce-gpu-topology-predicate"
              },
              {
                "name": "cce-gpu-topology-priority"
              },
              {
                "name": "cce-gpu"
              }
            ]
          },
          {
            "plugins": [
              {
                "name": "nodelocalvolume"
              },
              {
                "name": "nodeemptydirvolume"
              },
              {
                "name": "nodeCSIscheduling"
              },
              {
                "name": "networkresource"
              }
            ]
          }
        ]
      },
      "deschedulerPolicy": {
        "profiles": [
          {
            "name": "ProfileName",
            "pluginConfig": [
              {
                "args": {
                  "ignorePvcPods": true,
                  "nodeFit": true,
                  "priorityThreshold": {
                    "value": 100
                  }
                },
                "name": "DefaultEvictor"
              },
              {
                "args": {
                  "evictableNamespaces": {
                    "exclude": ["kube-system"]
                  },
                  "thresholds": {
                    "cpu": 25,
                    "memory": 25
                  }
                },
                "name": "HighNodeUtilization"
              }
            ],
            "plugins": {
              "balance": {
                "enabled": ["HighNodeUtilization"]
              }
            }
          }
        ]
      },
      "descheduler_enable": "true",
      "deschedulingInterval": "10m"
    }
    Table 3 Key parameters of a cluster descheduling policy

    Parameter

    Description

    descheduler_enable

    Whether to enable a cluster descheduling policy.

    • true: The cluster descheduling policy is enabled.
    • false: The cluster descheduling policy is disabled.

    deschedulingInterval

    Descheduling period.

    deschedulerPolicy

    Cluster descheduling policy. For details, see Table 4.

    Table 4 deschedulerPolicy parameters

    Parameter

    Description

    profiles.[].plugins.balance.enable.[]

    Descheduling policy for a cluster.

    HighNodeUtilization: the policy for minimizing CPU and memory fragments is used.

    profiles.[].pluginConfig.[].name

    Configuration of a load-aware descheduling policy. Options:

    • DefaultEvictor: default eviction policy
    • HighNodeUtilization: policy for minimizing CPU and memory fragments

    profiles.[].pluginConfig.[].args

    Descheduling policy configuration of a cluster.

    • Configurations for the DefaultEvictor policy:
      • ignorePvcPods: whether PVC pods should be ignored or evicted. Value true indicates that the pods are ignored, and value false indicates that the pods are evicted. This configuration does not differentiate PVC types (local PVs, SFS, or EVS).
      • nodeFit: whether to consider the existing scheduling configurations such as node affinity and taint on the node during descheduling. Value true indicates that the existing scheduling configurations will be considered, and value false indicates that those will be ignored.
      • priorityThreshold: priority setting. If the priority of a pod is greater than or equal to the value of this parameter, the pod will not be evicted. Example:
        {
          "value": 100
        }
    • Configurations for the HighNodeUtilization policy:
      • evictableNamespaces: namespaces where the eviction policy takes effect. The default value is the namespaces other than kube-system. Example:
        {
          "exclude": ["kube-system"]
        }
      • thresholds: threshold for evicting pods from a node. When the CPU or memory usage of a node is less than the threshold, the pods on the node will be evicted. Example:
        {
          "cpu": 25,
          "memory": 25
        }

  4. Click OK.

Use Cases

HighNodeUtilization

  1. Check the nodes in a cluster. It is found that some nodes are under-utilized.

  2. Edit the Volcano parameters to enable the descheduler and set the CPU and memory usage thresholds to 25. When the CPU and memory usage of a node is less than 25%, pods on the node will be evicted.

  3. After the policy takes effect, pods on the node with IP address 192.168.44.152 will be migrated to the node with IP address 192.168.54.65 for minimized resource fragments.

Common Issues

If an input parameter is incorrect, for example, the entered value is beyond the accepted value range or in an incorrect format, an event will be generated.

We use cookies to improve our site and your experience. By continuing to browse our site you accept our cookie policy. Find out more

Feedback

Feedback

Feedback

0/500

Selected Content

Submit selected content with the feedback