Method and system for reducing carbon emission based on K8S scheduling optimization and electronic equipment

CN120492147APending Publication Date: 2025-08-15DUXIAOMAN TECH (BEIJING) CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510540044.1
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-04-27
Publication Date
2025-08-15

Smart Images

  • Figure CN120492147A_ABST
    Figure CN120492147A_ABST
Patent Text Reader

Abstract

The invention provides a method and system for optimizing and reducing carbon emission based on K8S scheduling and electronic equipment, on the basis of Pod request scheduling of a traditional K8S architecture, a multi-dimensional carbon emission perception scheduling algorithm is newly added, when a Pod request to be scheduled is obtained, the resource consumption condition and the energy consumption condition of each working machine are obtained, and the scheduling efficiency of the Pod request to be scheduled is improved. The method comprises the steps that firstly, a Pod request is sent to each working machine, then the fitness score between each current working machine and the Pod request is calculated based on a built-in preset multi-dimensional carbon emission perceptual scheduling algorithm, then Pod scheduling is carried out on the Pod request to be scheduled according to the fitness score, the Pod request is scheduled to a target working machine, and the target working machine responds to the Pod request. By selecting the embodiment of the invention, the Pod request is scheduled according to the fitness score, a scheme that traditional K8S scheduling only pays attention to resource matching can be optimized, and dynamic balance among resource utilization, energy efficiency and carbon emission can be realized.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of database management technology, and in particular to a method, system and electronic device for reducing carbon emissions based on K8S scheduling optimization. Background Art

[0002] With the development of information technology, the scale and number of data rooms are constantly increasing. Since the operation of data rooms requires a large amount of electricity support, the heat generated by the operation of the equipment needs to be dissipated by refrigeration equipment, heat dissipation equipment, etc., which further increases energy consumption. In addition, a large amount of greenhouse gases such as carbon dioxide will be generated during the power production and operation of the data room, increasing carbon emissions.

[0003] Therefore, data center energy consumption and carbon emissions are issues that cannot be ignored. To promote the green and low-carbon development of the digital industry and accelerate the green transformation of key areas such as data centers, relevant policies require enterprises to manage the carbon emissions of their data centers and databases. This aims to optimize energy utilization, improve energy efficiency, reduce data center operating costs, and minimize negative environmental impacts. However, there is a lack of carbon emission management technologies for data centers or databases on the market. Summary of the Invention

[0004] In view of this, the embodiments of the present application provide a method, system and electronic device for reducing carbon emissions based on K8S scheduling optimization, so as to optimize the K8S-based database scheduling scheme and achieve a dynamic balance between resource utilization, energy efficiency and carbon emissions.

[0005] In a first aspect, an embodiment of the present application provides a method for reducing carbon emissions based on K8S scheduling optimization, wherein the method includes:

[0006] Obtain the Pod request to be scheduled and the resource and energy consumption of each worker machine. The Pod request carries the requested CPU resources and memory resources. The resource consumption includes the remaining CPU and memory, and the energy consumption includes the energy consumption of the provided hardware resources and the carbon emission intensity of the workload.

[0007] Based on the CPU resources and memory resources used by the request, combined with the resource consumption and energy consumption of each worker machine, the suitability score between each worker machine and the Pod request is calculated according to a preset multi-dimensional carbon emission-aware scheduling algorithm;

[0008] The preset multi-dimensional carbon emission-aware scheduling algorithm is a weighted function pre-constructed based on the ratio of resource request amount to remaining amount, energy utilization rate, and the carbon emission intensity of the workload, wherein the ratio of resource request amount to remaining amount includes: a first ratio between the CPU resource and the remaining CPU, and a second ratio between the memory resource and the remaining memory; the energy utilization rate is calculated based on the energy consumption of the provided hardware resources;

[0009] According to the fitness score, a target work machine for deploying the Pod request is determined, and the Pod request is scheduled and deployed to the target work machine so that the target work machine responds to the Pod request.

[0010] In combination with the first aspect, in a second possible embodiment, the method further includes:

[0011] Obtaining a carbon emission weight factor, and determining a target work machine for deploying the Pod request based on the fitness score, including:

[0012] If the carbon emission weight factor approaches 1, determining the working machine with the highest fitness score as the target working machine;

[0013] If the carbon emission weight factor approaches 0, the working machine having the fitness score higher than a preset fitness score threshold is determined as the target working machine.

[0014] In combination with the first aspect, in a third possible embodiment, the preset multi-dimensional carbon emission-aware scheduling algorithm satisfies the following formula:

[0015] S=α×(Resourcerequested / Resourceremaining)+β×Eefficiency+γ×(1 / Cintensity)

[0016] Among them, S is the fitness score, Resourcerequested / Resourceremaining is the ratio of the resource request amount to the remaining amount, α is the weight coefficient of the ratio of the resource request amount to the remaining amount, Eefficiency is the energy utilization rate, β is the weight coefficient of the energy utilization rate, Cintensity is the carbon emission intensity of the workload, γ is the weight coefficient of the carbon emission intensity of the workload, and α+β+γ=1.

[0017] In combination with the first aspect, in a fourth possible embodiment, the energy utilization rate is calculated using the following formula:

[0018]

[0019] Among them, Resourceprovided is the provided hardware resources, and the hardware resources include: the number of CPU cores, memory capacity, and storage read and write speed provided by the working machine; Energyconsumed is the energy consumption of the provided hardware resources.

[0020] In combination with the first aspect, in a fifth possible embodiment, the method is applied to a K8S scheduler, and the method further includes:

[0021] Obtaining the energy consumption of the provided hardware resources through a first communication interface with a smart meter of each of the working machines at a preset time interval, or obtaining the energy consumption of the provided hardware resources through a second communication interface with a hardware power consumption management module of each of the working machines;

[0022] The workload carbon emission intensity is obtained through a third communication interface with the carbon emission accounting system.

[0023] In combination with the fifth possible embodiment of the first aspect, in a sixth possible embodiment, the method further includes:

[0024] Performing data cleaning and outlier processing on the energy consumption of the provided hardware resources and the carbon emission intensity of the workload;

[0025] The fitness score between each of the working machines and the Pod request is calculated based on the data cleaning, the energy consumption after the outlier processing, and the workload carbon emission intensity.

[0026] In a second aspect, an embodiment of the present application provides a system for reducing carbon emissions based on K8S scheduling optimization, the system comprising: a K8S scheduler, a carbon emissions data collection module, and a carbon emissions analysis and decision module; wherein:

[0027] The K8S scheduler is used to obtain a Pod request to be scheduled, where the Pod request carries the requested CPU resources and memory resources;

[0028] The carbon emission data collection module is used to obtain the resource consumption and energy consumption of each working machine. The resource consumption includes: remaining CPU and remaining memory; the energy consumption includes: energy consumption of provided hardware resources and workload carbon emission intensity;

[0029] The carbon emission analysis and decision module is used to calculate the fitness score between each of the worker machines and the Pod request based on the CPU resources and memory resources used by the request, combined with the resource consumption and energy consumption of each of the worker machines, in accordance with a preset multi-dimensional carbon emission-aware scheduling algorithm;

[0030] The preset multi-dimensional carbon emission-aware scheduling algorithm is a weighted function pre-constructed based on the ratio of resource request amount to remaining amount, energy utilization rate, and the carbon emission intensity of the workload, wherein the ratio of resource request amount to remaining amount includes: a first ratio between the CPU resource and the remaining CPU, and a second ratio between the memory resource and the remaining memory; the energy utilization rate is calculated based on the energy consumption of the provided hardware resources;

[0031] The K8S scheduler is further used to determine the target work machine for deploying the Pod request based on the fitness score, and schedule and deploy the Pod request to the target work machine so that the target work machine responds to the Pod request.

[0032] In conjunction with the second aspect, in a second possible embodiment, the K8S scheduler is further used to:

[0033] Obtaining a carbon emission weight factor, and determining a target work machine for deploying the Pod request based on the fitness score, including:

[0034] If the carbon emission weight factor approaches 1, determining the working machine with the highest fitness score as the target working machine;

[0035] If the carbon emission weight factor approaches 0, the working machine having the fitness score higher than a preset fitness score threshold is determined as the target working machine.

[0036] In conjunction with the second aspect, in a third possible embodiment, the preset multi-dimensional carbon emission-aware scheduling algorithm satisfies the following formula:

[0037] S=α×(Resourcerequested / Resourceremaining)+β×Eefficiency+γ×(1 / Cintensity)

[0038] Among them, S is the fitness score, Resourcerequested / Resourceremaining is the ratio of the resource request amount to the remaining amount, α is the weight coefficient of the ratio of the resource request amount to the remaining amount, Eefficiency is the energy utilization rate, β is the weight coefficient of the energy utilization rate, Cintensity is the carbon emission intensity of the workload, γ is the weight coefficient of the carbon emission intensity of the workload, and α+β+γ=1.

[0039] In combination with the second aspect, in a fourth possible embodiment, the energy utilization rate is calculated using the following formula:

[0040]

[0041] Among them, Resourceprovided is the provided hardware resources, and the hardware resources include: the number of CPU cores, memory capacity, and storage read and write speed provided by the working machine; Energyconsumed is the energy consumption of the provided hardware resources.

[0042] In combination with the second aspect, in a fifth possible embodiment, the K8S scheduler is further used to:

[0043] Obtaining the energy consumption of the provided hardware resources through a first communication interface with a smart meter of each of the working machines at a preset time interval, or obtaining the energy consumption of the provided hardware resources through a second communication interface with a hardware power consumption management module of each of the working machines;

[0044] The workload carbon emission intensity is obtained through a third communication interface with the carbon emission accounting system.

[0045] In combination with the fifth possible embodiment of the second aspect, in a sixth possible embodiment, the K8S scheduler is further used to:

[0046] Performing data cleaning and outlier processing on the energy consumption of the provided hardware resources and the carbon emission intensity of the workload;

[0047] The fitness score between each of the working machines and the Pod request is calculated based on the data cleaning, the energy consumption after the outlier processing, and the workload carbon emission intensity.

[0048] In a third aspect, an embodiment of the present application provides an electronic device, wherein the electronic device includes: a processor; and a memory for storing a program; wherein the program includes instructions, which, when executed by the processor, enable the processor to execute the method for reducing carbon emissions based on K8S scheduling optimization described in the first aspect.

[0049] In a fourth aspect, an embodiment of the present application provides a non-transitory computer-readable storage medium storing computer instructions, wherein the computer instructions are used to enable a computer to execute the method for reducing carbon emissions based on K8S scheduling optimization described in the first aspect.

[0050] Beneficial effects of this application:

[0051] The present application provides a method, system and electronic device for reducing carbon emissions based on K8S scheduling optimization. On the basis of the Pod request scheduling of the traditional K8S architecture, a multi-dimensional carbon emission-aware scheduling algorithm is added. When obtaining the Pod request to be scheduled, the resource consumption and energy consumption of each work machine are obtained, and then based on the built-in preset multi-dimensional carbon emission-aware scheduling algorithm, the fitness score between each current work machine and the Pod request is calculated, and then the Pod request to be scheduled is Pod scheduled according to the fitness score, and the Pod request is scheduled to the target work machine, and the target work machine responds to the Pod request.

[0052] In the embodiment of the present application, since the preset multi-dimensional carbon emission-aware scheduling algorithm is a weighted function constructed in advance based on the ratio of resource request quantity to remaining quantity, energy utilization rate, and workload carbon emission intensity, by selecting the embodiment of the present application, before scheduling the Pod request, the actual energy consumption and carbon emission intensity of each working machine can be combined to calculate the fitness score between the Pod request, and then the Pod request can be scheduled according to the fitness score. The traditional K8S scheduling solution that only focuses on resource matching can be optimized, and a dynamic balance between resource utilization, energy efficiency and carbon emissions can be achieved. BRIEF DESCRIPTION OF THE DRAWINGS

[0053] Further details, features and advantages of the present application are disclosed in the following description of exemplary embodiments in conjunction with the accompanying drawings, in which:

[0054] Figure 1 A flow chart of a method for reducing carbon emissions based on K8S scheduling optimization provided by this application is shown;

[0055] Figure 2 Another flow chart of the method for reducing carbon emissions based on K8S scheduling optimization provided by the present application is shown;

[0056] Figure 3 Another flow chart of the method for reducing carbon emissions based on K8S scheduling optimization provided by the present application is shown;

[0057] Figure 4 A schematic diagram of the system architecture of a system for reducing carbon emissions based on K8S scheduling optimization provided by the present application is shown;

[0058] Figure 5 A structural block diagram of an exemplary electronic device provided by the present application that can be used to implement the embodiments of the present application is shown. DETAILED DESCRIPTION

[0059] The following describes embodiments of the present application in more detail with reference to the accompanying drawings. Although certain embodiments of the present application are shown in the accompanying drawings, it should be understood that the present application can be implemented in various forms and should not be construed as limited to the embodiments described herein. Instead, these embodiments are provided to provide a more thorough and complete understanding of the present application. It should be understood that the drawings and embodiments of the present application are for illustrative purposes only and are not intended to limit the scope of protection of the present application.

[0060] It should be understood that the various steps described in the method embodiments of the present application can be performed in different orders and / or in parallel. In addition, the method embodiments may include additional steps and / or omit the steps shown. The scope of the present application is not limited in this respect.

[0061] The term "including" and its variations used in this document are open inclusions, that is, "including but not limited to". The term "based on" means "based at least in part on". The term "one embodiment" means "at least one embodiment"; the term "another embodiment" means "at least one other embodiment"; the term "some embodiments" means "at least some embodiments". The relevant definitions of other terms will be given in the description below. It should be noted that the concepts of "first", "second", etc. mentioned in this application are only used to distinguish different devices, modules or units, and are not used to limit the order or interdependence of the functions performed by these devices, modules or units.

[0062] It should be noted that the modifications of "one" and "multiple" mentioned in this application are illustrative rather than restrictive. Those skilled in the art should understand that unless otherwise clearly indicated in the context, they should be understood as "one or more".

[0063] Before describing the method, system, and electronic device for reducing carbon emissions based on K8S scheduling optimization provided in this application, the following technical terms that may be involved in this article are explained:

[0064] K8S: Short for Kubernetes, Kubernetes is an open source container orchestration platform that automates the deployment, scaling, and management of application containers. It can efficiently schedule containerized applications in a cluster, achieve rational resource allocation, and achieve high application availability.

[0065] Pod: The smallest deployable and manageable computing unit in Kubernetes, which can contain one or more closely related containers. These containers share resources such as network namespaces and storage volumes, and they work together in the same Pod as if running on a single logical host.

[0066] Pod requests: Various request operations related to Pod resource objects, including create, delete, update, and query requests. Pod requests are the smallest deployable and manageable computing unit in Kubernetes. They can consist of one or more closely related containers. These containers share resources such as network namespaces and storage volumes, and they work together in the same Pod, just like running on a single logical host.

[0067] ApiServer: One of the core components of K8S, it provides a RESTful API interface and is the entry point for external clients to interact with the K8S cluster. It is responsible for receiving and processing various requests, such as creating, querying, updating, and deleting resource objects, and verifying the legitimacy of the requests.

[0068] Controller: Responsible for maintaining the desired state of various resource objects in the K8S cluster. By continuously monitoring the difference between the actual state and the desired state, it automatically performs repair and adjustment operations to ensure the stability and consistency of the cluster.

[0069] Scheduler: The Kubernetes scheduler is responsible for assigning newly created pods to the most suitable nodes in the cluster. It makes decisions based on a complex scheduling algorithm that considers factors such as node resources, node health, and pod resource requests.

[0070] Node energy efficiency index: It is measured by the computing resources provided by the node per unit energy consumption. The formula is, which covers a variety of computing resources and represents the total energy consumed by the node. This indicator is used to evaluate the energy utilization efficiency of the node.

[0071] Workload carbon emission intensity: refers to the total amount of carbon emissions generated in the process of completing a specific workload, which is used to measure the carbon emission characteristics of different workloads.

[0072] Fitness score: A quantitative indicator used to evaluate the suitability of a node for a pod in a scheduling algorithm based on carbon emission optimization.

[0073] Existing technologies, namely traditional K8S scheduling strategies, have obvious deficiencies in terms of resource utilization and carbon emissions:

[0074] 1) Ignoring carbon emissions: Traditional Kubernetes scheduling strategies primarily focus on resource utilization and application performance, completely ignoring carbon emissions. In today's global context of promoting sustainable development and closely monitoring data center energy consumption and carbon emissions, this neglect leads to increasing carbon emissions from data centers, running counter to environmental protection principles and exposing businesses to higher energy costs.

[0075] 2) Unbalanced resource allocation: Unbalanced resource allocation is common when scheduling decisions are made without fully considering node energy efficiency and workload carbon intensity. For example, concentrating a large workload on certain nodes can lead to higher energy consumption and increased cooling system burden, resulting in higher carbon emissions. This can also impact node lifespan and stability.

[0076] 3) Lack of Dynamic Adaptability: Traditional scheduling strategies lack the ability to dynamically adjust to complex and changing workload scenarios. They are unable to flexibly adjust scheduling decisions based on real-time energy consumption and carbon emissions data, as well as workload changes, to achieve a balance between resource utilization, energy efficiency, and carbon emissions. This prevents the full potential of clusters from being realized in practical applications, reducing overall operational efficiency.

[0077] In general, traditional Kubernetes scheduling algorithms primarily focus on matching resource supply and demand when selecting nodes, measuring the compatibility between nodes and pods solely based on resource dimensions such as CPU, memory, and storage. While this approach ensures application operation to a certain extent, it completely ignores energy consumption and carbon emissions, presenting significant limitations in today's climate of green computing.

[0078] In view of this, the present application provides a method, system and electronic device for reducing carbon emissions based on K8S scheduling optimization. On the first aspect, the present application provides a method for reducing carbon emissions based on K8S scheduling optimization. The method is applied to any electronic device that has the function of reducing carbon emissions based on K8S scheduling optimization, including but not limited to personal mobile terminals, computers or servers. As a possible implementation method, the method provided by the present application can be applied to the K8S scheduler under the traditional K8S architecture, that is, by integrating the operating logic of the method provided by the present application into the K8S scheduler under the traditional K8S architecture, the shortcomings of the traditional K8S scheduling strategy in energy and carbon emission management can be solved.

[0079] Specifically, the execution code logic of the preset multi-dimensional carbon emission-aware scheduling algorithm designed in this application can be embedded into the K8S code. This is a complex and sophisticated process that requires an in-depth understanding of the original code structure of the K8S scheduler to ensure that the newly embedded computing logic can be seamlessly connected with the existing scheduling process without affecting the normal operation of the K8S scheduler.

[0080] In some possible embodiments, the method for reducing carbon emissions based on K8S scheduling optimization provided by this application can be as follows: Figure 1 As shown, the method includes the following steps:

[0081] S11. Obtain the Pod request to be scheduled, and obtain the resource consumption and energy consumption of each working machine.

[0082] The Pod request carries the requested CPU resources and memory resources; the resource consumption includes the remaining CPU and remaining memory; and the energy consumption includes the energy consumption of the provided hardware resources and the carbon emission intensity of the workload.

[0083] S12. Based on the CPU resources and memory resources used by the request, combined with the resource consumption and energy consumption of each worker machine, and in accordance with a preset multi-dimensional carbon emission-aware scheduling algorithm, calculate the fitness score between each worker machine and the Pod request;

[0084] Among them, the preset multi-dimensional carbon emission-aware scheduling algorithm is a weighted function constructed in advance based on the ratio of resource request amount to remaining amount, energy utilization rate, and carbon emission intensity of the workload. The ratio of resource request amount to remaining amount includes: a first ratio between the CPU resources and the remaining CPUs, and a second ratio between the memory resources and the remaining memory; the energy utilization rate is calculated based on the energy consumption of the provided hardware resources.

[0085] S13. Determine a target work machine for deploying the Pod request based on the fitness score, and schedule and deploy the Pod request to the target work machine so that the target work machine responds to the Pod request.

[0086] The method for reducing carbon emissions based on K8S scheduling optimization provided in this application adds a multi-dimensional carbon emission-aware scheduling algorithm on the basis of the Pod request scheduling of the traditional K8S architecture. When obtaining the Pod request to be scheduled, the resource consumption and energy consumption of each work machine are obtained, and then based on the built-in preset multi-dimensional carbon emission-aware scheduling algorithm, the fitness score between each current work machine and the Pod request is calculated, and then the Pod request to be scheduled is Pod scheduled according to the fitness score, and the Pod request is scheduled to the target work machine, and the target work machine responds to the Pod request.

[0087] In the embodiment of the present application, since the preset multi-dimensional carbon emission-aware scheduling algorithm is a weighted function constructed in advance based on the ratio of resource request quantity to remaining quantity, energy utilization rate, and workload carbon emission intensity, by selecting the embodiment of the present application, before scheduling the Pod request, the actual energy consumption and carbon emission intensity of each working machine can be combined to calculate the fitness score between the Pod request, and then the Pod request can be scheduled according to the fitness score. The traditional K8S scheduling solution that only focuses on resource matching can be optimized, and a dynamic balance between resource utilization, energy efficiency and carbon emissions can be achieved.

[0088] The following will describe the above steps S11 to S13 in detail with reference to specific examples:

[0089] In some possible embodiments, Figure 2 As shown, when executing step S11, it can be achieved through the following steps:

[0090] S11-1. Obtaining, at preset time intervals, the energy consumption of the provided hardware resources through a first communication interface with a smart meter of each of the working machines, or obtaining the energy consumption of the provided hardware resources through a second communication interface with a hardware power consumption management module of each of the working machines;

[0091] S11-2. Obtain the workload carbon emission intensity through a third communication interface with the carbon emission accounting system.

[0092] Specifically, the preset time interval is a data acquisition period flexibly set according to actual needs. The specific time interval size can be flexibly set according to actual conditions and is not strictly limited in this application. As a preferred embodiment, the preset time interval can be 5 minutes.

[0093] In an embodiment of the present application, in order to obtain accurate energy consumption data and carbon emission data, the present application has made the following modifications to the execution logic of K8S, integrating the smart meter of the working machine, the hardware power consumption management module of the working machine, and the carbon emission accounting system into the K8S scheduler. Specifically, the APIs opened by the smart meter, the hardware power consumption management module, and the carbon emission accounting system are connected to the K8S scheduler so that K8S can obtain the required energy consumption data and carbon emission data from the corresponding APIs. Among them, the embodiment of the present application determines the communication API between the smart meter and the K8S scheduler as the first communication interface, the communication API between the hardware power consumption management module and the K8S scheduler as the second communication interface, and the communication API between the carbon emission accounting system and the K8S scheduler as the third communication interface.

[0094] Specifically, in terms of energy consumption data monitoring, or when obtaining energy consumption data, the K8S scheduler can obtain energy consumption data through the above-mentioned first communication interface or the second communication interface, and specifically obtain the energy consumption generated by the working machine when providing corresponding hardware resources. In the embodiment of the present application, the energy consumption situation specifically refers to the power consumption situation. As an implementation method, the power consumption data of each working machine can be obtained through the smart meter of each working machine in the data room. If the working machine is a server, the server also has a hardware power consumption management module, such as the iDRAC (a hardware power consumption management module) management module provided by some service providers, which can obtain the energy consumption and resource consumption of the working machine by reading the detailed hardware power consumption information recorded in the iDRAC.

[0095] As an implementation, energy consumption data for working machines can be obtained at the device level by connecting to interfaces of monitoring devices such as smart meters, server power consumption monitoring modules, and network equipment. For example, the system can be connected to a network switch via SNMP (Simple Network Management Protocol) to obtain power consumption data during data transmission.

[0096] As another embodiment, when executing step S11, a public carbon emission factor database can be used to obtain a carbon emission factor, such as the carbon emission factor data released by the International Energy Agency, and the workload carbon emission intensity of the working machine can be determined based on the carbon emission factor. In an embodiment of the present application, the carbon emission factor, also known as the carbon emission coefficient, refers to the amount of carbon dioxide (or other greenhouse gas) emissions generated by unit energy consumption or activity under specific conditions. For example, the electricity and heat carbon dioxide emission factors of various countries and regions published by the International Energy Agency in 2022 can be obtained, and the carbon emissions of the working machine during the working hours can be calculated in combination. As another embodiment, when executing step S11, more accurate carbon emission factor information can be obtained by cooperating with energy suppliers.

[0097] As another implementation method, in order to improve the efficiency and timeliness of data collection, multi-threading technology can be used between the K8S scheduler and the smart meter, hardware power consumption management module, and carbon emission accounting system to achieve concurrent data collection from multiple data sources. After preliminary preprocessing of the collected data, the carbon emission intensity of the workload of each work machine can be calculated in combination with the carbon emission factor. Among them, the workload emission intensity C intensity The calculation of carbon emissions must be based on the total carbon emissions under a specific workload and the scale of that specific workload, and is closely related to the carbon emission factor. The specific calculation process is as follows:

[0098] 1) Clarify the calculation of total carbon emissions: First, use energy monitoring tools, such as smart meters and server-side power consumption monitoring modules (like the iDRAC management module), to accurately collect energy consumption data for each node while the workload is running. Power consumption data is obtained from smart meters via the Modbus protocol interface and combined with server hardware power consumption information to determine the total energy consumption value. Then, based on publicly available carbon emission factor databases (such as those published by the International Energy Agency (IEA)) or local carbon emission factors obtained through collaboration with energy suppliers, calculate the total carbon emissions generated by the corresponding workload using the formula "Carbon emissions = energy consumption × carbon emission factor."

[0099] 2) Determine the workload volume: The workload volume (Workloadvolume) of a workload must be determined based on the specific application scenario. In web applications, this might be the number of user requests processed; in big data processing tasks, it might be the amount of data processed, such as the number of rows processed or the size of a data file. For example, when processing user requests, the total number of requests processed within a specific time period can be counted from web server logs to represent the workload volume.

[0100] 3) Calculate workload emission intensity: After obtaining the total carbon emissions generated by the workload and the corresponding workload volume, use the formula Cintensity = Workload volume /

[0101] Carbonemission calculates workload emission intensity. This value indicates the carbon emission intensity generated by processing each user request. This helps to allocate carbon emissions based on the carbon emission characteristics of different workloads during K8S scheduling, thereby reducing the overall carbon emissions of the cluster.

[0102] That is, the workload carbon emission intensity is determined as parameter C intensity The carbon emission intensity of this workload can be calculated based on the following formula:

[0103] Cintensity=Workloadvolume / Carbonemission

[0104] Carbonemission represents the total carbon emissions generated during the completion of a specific workload volume. The significance of Carbonemission lies in distinguishing the carbon emission characteristics of different work machines and workloads. This allows subsequent Pod scheduling to allocate high-carbon emission workloads to more appropriate work machines, thereby reducing the carbon emissions of the entire data cluster.

[0105] The workload volume refers to the total amount of resources occupied by the tasks currently assigned to the worker machine. For example, if worker machine A is currently running 10 Pod tasks, occupying a total of 12 CPU cores and 512 GB of memory, the workload volume represents the amount of carbon emissions generated by worker machine A when running these 10 Pod tasks using 12 CPU cores and 512 GB of memory.

[0106] On the basis of the above steps S11-1 and S11-2, the process of executing the above step S11 may further include the following steps:

[0107] S11-3. Perform data cleaning and outlier processing on the energy consumption of the provided hardware resources and the carbon emission intensity of the workload.

[0108] It can be understood that data cleaning and outlier processing are means of data preprocessing. Specifically, data cleaning refers to the process of reviewing and verifying data, with the aim of deleting duplicate information, correcting existing errors, and maintaining data consistency and integrity, thereby improving data quality.

[0109] An outlier is a data point in a dataset that differs significantly from other data points, significantly deviating from the overall data distribution. It may be significantly larger or smaller than the rest of the data, or exhibit a distinct isolation in the data distribution. Outlier processing involves various methods, such as deletion, mean / median filling, and data transformation, to address outliers in the energy and resource consumption data collected, minimizing the impact of these outliers on the subsequent fitness score calculations.

[0110] On this basis, when executing the above step S12, it can be achieved through the following steps:

[0111] The fitness score between each of the working machines and the Pod request is calculated based on the data cleaning, the energy consumption after the outlier processing, and the workload carbon emission intensity.

[0112] As described above, the preset multi-dimensional carbon emission-aware scheduling algorithm is a weighted function pre-constructed based on the ratio of resource request amount to remaining amount, energy utilization rate, and the carbon emission intensity of the workload. Specifically, it can be a function obtained by weighted summation of the ratio of resource request amount to remaining amount, energy utilization rate, and the carbon emission intensity of the workload. In some possible embodiments, the preset multi-dimensional carbon emission-aware scheduling algorithm in step S12 satisfies the following formula:

[0113] S=α×(Resourcerequested / Resourceremaining)+β×Eefficiency+γ×(1 / Cintensity)

[0114] Among them, S is the fitness score, Resourcerequested / Resourceremaining is the ratio of the resource request amount to the remaining amount, α is the weight coefficient of the ratio of the resource request amount to the remaining amount, Eefficiency is the energy utilization rate, β is the weight coefficient of the energy utilization rate, Cintensity is the carbon emission intensity of the workload, γ is the weight coefficient of the carbon emission intensity of the workload, and α+β+γ=1.

[0115] Among them, α, β, and γ are weight coefficients. α represents the degree of influence of resource surplus on the fitness score, β represents the degree of influence of energy utilization efficiency on the fitness score, and γ represents the degree of influence of carbon emission intensity on the fitness score, and they satisfy α+β+γ=1. The three weight coefficients are not fixed, but can be flexibly adjusted according to different application scenarios and needs. For example, in a green data center scenario with extremely high carbon emission requirements, the values of β and γ can be appropriately increased, so that nodes with high energy efficiency and low workload carbon emission intensity will be more likely to be selected during scheduling. In a scenario with strict application performance requirements, the proportion of α can be increased to prioritize the reasonable allocation of resources to meet the performance requirements of the application.

[0116] In the embodiment of the present application, the fitness score refers to a quantitative indicator used to evaluate the suitability of a node (one working machine corresponds to one node) for a Pod in a preset multi-dimensional carbon emission-aware scheduling algorithm.

[0117] In some possible embodiments, the energy utilization rate is calculated using the following formula:

[0118]

[0119] Among them, Resourceprovided is the provided hardware resources, and the hardware resources include: the number of CPU cores, memory capacity, and storage read and write speed provided by the working machine; Energyconsumed is the energy consumption of the provided hardware resources.

[0120] In this embodiment, ResourceProvided is a comprehensive metric that covers multiple dimensions of computing resources, including the number of CPU cores, memory capacity, and storage read / write rates. EnergyConsumed represents the total energy consumed by the worker machine in providing these computing resources. This metric clearly demonstrates the differences in energy efficiency between different nodes, providing a strong basis for scheduling decisions.

[0121] As a preferred implementation, the energy utilization rate Eefficiency represents the effectiveness of the energy use of the working machine when providing resources. If the Eefficiency value is 0.5, it means that the effectiveness of the energy use of the working machine when providing resources is 50%. This is a relatively low energy utilization efficiency, but it still needs to be included in the calculation when calculating the fitness score.

[0122] The resource request / resource remaining ratio (Resourcerequested / Resourceremaining) includes a first ratio between the CPU request and the CPU remaining, and a second ratio between the memory request and the memory remaining. Specifically, the first ratio is the ratio between the CPU requested by the Pod to be scheduled and the CPU resources currently remaining on the worker machine, and the second ratio is the ratio between the memory requested by the Pod to be scheduled and the memory resources currently remaining on the worker machine.

[0123] Among them, the first ratio and the second ratio should meet the following requirements: the first ratio is less than 1, and the second ratio is less than 1. That is, the remaining CPU can meet the CPU request, and the remaining memory can meet the requested memory. This means that the working machine has sufficient remaining resources in terms of CPU resources and memory resources to meet the requirements of the Pod request.

[0124] In this way, the fitness score S between each worker machine and the Pod request to be scheduled can be calculated based on the weighted sum function, and then step S13 is executed to schedule the Pod request according to the fitness score.

[0125] To understand the above process of calculating fitness scores, you can use the following calculation example to understand it:

[0126] Assume there are three worker machines, Node1, Node2, and Node3. A user generates a Pod request that specifies 2 CPU cores and 4 GB of memory.

[0127] Node1 has 4 CPU cores and 8 GB of memory remaining. The CPU resource provided by Node1 per unit of energy consumption is 0.5 cores / watt, and the workload carbon emission intensity is 0.8 tons per unit of workload.

[0128] Node2 has 3 remaining CPU cores and 6 GB of remaining memory. The CPU resources provided by Node2 per unit energy consumption, obtained through the communication interface with Node2, are 0.6 cores / watt, and the workload carbon emission intensity is 0.7 tons / unit of workload.

[0129] Node3 has 5 remaining CPU cores and 10 GB of memory. Through the communication interface with Node3, we can obtain that the CPU resources provided by Node3 per unit energy consumption are 0.4 cores / watt, and the workload carbon emission intensity is 0.9 tons / unit of workload.

[0130] At this time, it is assumed that α=0.4, β=0.3, and γ=0.3.

[0131] For the working machine Node1, we can calculate:

[0132] The ratio of resource request amount to remaining amount:

[0133] First ratio: CPU: Resource requested / Resource remaining = 2 / 4 = 1 / 2

[0134] Second ratio: Memory: Resource requested / Resource remaining = 2 / 4 = 1 / 2

[0135] Both are less than 1, indicating that the worker machine Node1 has sufficient remaining resources in terms of CPU and memory to meet the Pod's request.

[0136] Combined with the energy utilization rate of the work machine Node1 = 0.5 cores / watt, the workload carbon emission intensity of the work machine Node1 is 0.8 tons / unit of workload.

[0137] At this point, the fitness score S between the worker machine Node1 and the Pod request to be scheduled can be calculated. node1 for:

[0138] S node1=0.4×(2+2) / 2+0.3×0.5+0.3×1.25

[0139] Calculate S node1 =1.325. Using the same algorithm, we can also calculate the fitness scores between the worker machines Node2 and Node3 and the Pod request to be scheduled. Then, based on the fitness scores, we schedule the Pod request and determine which worker machine to schedule it to.

[0140] In some possible embodiments, Figure 3 As shown, in the process of executing the above step S13, it can be achieved through the following steps:

[0141] S13-1. Obtain carbon emission weight factor;

[0142] S13-2. If the carbon emission weight factor approaches 1, determine the working machine with the highest fitness score as the target working machine;

[0143] S13-3. If the carbon emission weight factor approaches 0, determine the working machine whose fitness score is higher than a preset fitness score threshold as the target working machine.

[0144] Among them, the carbon emission weight factor refers to the parameter introduced in the scheduling algorithm based on carbon emission optimization. The value range is between 0 and 1. It is used to measure the importance of the carbon emission factor in the entire scheduling decision. The larger the value, the greater the impact of the carbon emission factor on the scheduling decision.

[0145] Specifically, as an implementation method, the carbon emission weight factor is represented by the parameter ω c Indicates that the value range of this factor is 0 to 1, and it plays a key regulatory role in the entire scheduling algorithm. c The size of directly determines the importance of carbon emission factors in scheduling decisions. c When it approaches 1, it means that during the scheduling process, the algorithm will give priority to nodes with lower carbon emissions to deploy Pods, and when ω c When it approaches 0, the impact of carbon emission factors on scheduling decisions will be greatly weakened, and the algorithm will focus more on traditional resource allocation strategies.

[0146] Based on the method described in the first aspect, in the second aspect, the embodiment of the present application provides a system for reducing carbon emissions based on K8S scheduling optimization, which can be as follows: Figure 4 As shown, the system 40 includes: a K8S scheduler 401, a carbon emission data collection module 402, and a carbon emission analysis and decision module 403; wherein:

[0147] The K8S scheduler is used to obtain a Pod request to be scheduled, where the Pod request carries the requested CPU resources and memory resources;

[0148] The carbon emission data collection module is used to obtain the resource consumption and energy consumption of each working machine. The resource consumption includes: remaining CPU and remaining memory; the energy consumption includes: energy consumption of provided hardware resources and workload carbon emission intensity;

[0149] The carbon emission analysis and decision module is used to calculate the fitness score between each of the worker machines and the Pod request based on the CPU resources and memory resources used by the request, combined with the resource consumption and energy consumption of each of the worker machines, in accordance with a preset multi-dimensional carbon emission-aware scheduling algorithm;

[0150] The preset multi-dimensional carbon emission-aware scheduling algorithm is a weighted function pre-constructed based on the ratio of resource request amount to remaining amount, energy utilization rate, and the carbon emission intensity of the workload, wherein the ratio of resource request amount to remaining amount includes: a first ratio between the CPU resource and the remaining CPU, and a second ratio between the memory resource and the remaining memory; the energy utilization rate is calculated based on the energy consumption of the provided hardware resources;

[0151] The K8S scheduler is further used to determine the target work machine for deploying the Pod request based on the fitness score, and schedule and deploy the Pod request to the target work machine so that the target work machine responds to the Pod request.

[0152] In the embodiments of this application, the carbon emission data collection module is a new component of the K8S scheduling system. It is responsible for collecting energy consumption data from energy monitoring devices and network devices at each node and calculating the corresponding carbon emission data based on the carbon emission factor. The carbon emission analysis and decision module is a new intelligent core component of the K8S scheduling system. It analyzes the collected carbon emission data according to pre-set algorithms and strategies, generates scheduling recommendations for different Pods, and feeds them back to the Scheduler (the scheduler that originally came with K8S).

[0153] As another implementation method, a machine learning algorithm can be used to model historical carbon emission data, and then the machine learning algorithm model can be trained. The trained model can then be used to calculate the carbon emission trend prediction results of the working machine based on the current workload of the working machine. The prediction results can then generate more accurate scheduling recommendations for different Pods. Specifically, the carbon emission analysis and decision module and Schedular can communicate through the message queue mechanism inside K8S, and the generated scheduling recommendations are sent to Scheduler in the form of messages, so that Schedular can comprehensively consider the scheduling recommendations from the carbon emission analysis and decision module and traditional resource scheduling factors when making scheduling decisions.

[0154] When the Scheduler receives a new Pod scheduling request, it first obtains a scheduling recommendation for the Pod from the carbon emission analysis and decision module. Then, based on its own understanding of the resource status of each worker machine, it calculates the fitness score of each worker machine for the Pod according to a preset multi-dimensional carbon emission-aware scheduling algorithm. Finally, the Scheduler determines the best running node for the Pod based on the score. Kubelet, as the agent component on the worker machine, is responsible for receiving Pod tasks assigned by the Scheduler and starting and managing the Pod locally. It maintains communication with the Scheduler through a heartbeat mechanism and regularly reports to the Scheduler on the operating status of the node and the operation status of the Pod. At the same time, Kubelet also interacts with the carbon emission data collection module, providing it with workload information of the Pod running on the worker machine, so that the carbon emission data collection module can more accurately calculate the carbon emission intensity.

[0155] Throughout the system's operation, components exchange data efficiently through Kubernetes' internal communication mechanisms. As Kubernetes' core control component, ApiServer coordinates communication between components to ensure the timeliness and accuracy of scheduling decisions. For example, when the carbon emissions data collection module collects new energy consumption data, it synchronizes this data with the carbon emissions analysis and decision-making module and the Scheduler via ApiServer, enabling the entire system to make scheduling decisions based on the latest data.

[0156] In conjunction with the second aspect, in a second possible embodiment, the K8S scheduler is further used to:

[0157] Obtaining a carbon emission weight factor, and determining a target work machine for deploying the Pod request based on the fitness score, including:

[0158] If the carbon emission weight factor approaches 1, determining the working machine with the highest fitness score as the target working machine;

[0159] If the carbon emission weight factor approaches 0, the working machine having the fitness score higher than a preset fitness score threshold is determined as the target working machine.

[0160] In conjunction with the second aspect, in a third possible embodiment, the preset multi-dimensional carbon emission-aware scheduling algorithm satisfies the following formula:

[0161] S=α×(Resourcerequested / Resourceremaining)+β×Eefficiency+γ×(1 / Cintensity)

[0162] Among them, S is the fitness score, Resourcerequested / Resourceremaining is the ratio of the resource request amount to the remaining amount, α is the weight coefficient of the ratio of the resource request amount to the remaining amount, Eefficiency is the energy utilization rate, β is the weight coefficient of the energy utilization rate, Cintensity is the carbon emission intensity of the workload, γ is the weight coefficient of the carbon emission intensity of the workload, and α+β+γ=1.

[0163] In combination with the second aspect, in a fourth possible embodiment, the energy utilization rate is calculated using the following formula:

[0164]

[0165] Among them, Resourceprovided is the provided hardware resources, and the hardware resources include: the number of CPU cores, memory capacity, and storage read and write speed provided by the working machine; Energyconsumed is the energy consumption of the provided hardware resources.

[0166] In combination with the second aspect, in a fifth possible embodiment, the K8S scheduler is further used to:

[0167] Obtaining the energy consumption of the provided hardware resources through a first communication interface with a smart meter of each of the working machines at a preset time interval, or obtaining the energy consumption of the provided hardware resources through a second communication interface with a hardware power consumption management module of each of the working machines;

[0168] The workload carbon emission intensity is obtained through a third communication interface with the carbon emission accounting system.

[0169] In combination with the fifth possible embodiment of the second aspect, in a sixth possible embodiment, the K8S scheduler is further used to:

[0170] Performing data cleaning and outlier processing on the energy consumption of the provided hardware resources and the carbon emission intensity of the workload;

[0171] The fitness score between each of the working machines and the Pod request is calculated based on the data cleaning, the energy consumption after the outlier processing, and the workload carbon emission intensity.

[0172] Among them, the collection, storage, use, processing, transmission, provision and disclosure of user personal information involved in this application are in compliance with relevant laws and regulations and do not violate public order and good morals.

[0173] The names of the messages or information exchanged between multiple devices in the embodiments of the present application are only used for illustrative purposes and are not used to limit the scope of these messages or information.

[0174] In a third aspect, exemplary embodiments of the present application further provide an electronic device, comprising: at least one processor; and a memory communicatively connected to the at least one processor. The memory stores a computer program executable by the at least one processor, wherein the computer program, when executed by the at least one processor, causes the electronic device to perform a method according to an embodiment of the present application.

[0175] An exemplary embodiment of the present application further provides a non-transitory computer-readable storage medium storing a computer program, wherein the computer program, when executed by a processor of a computer, is used to cause the computer to perform a method according to an embodiment of the present application.

[0176] An exemplary embodiment of the present application further provides a computer program product, including a computer program, wherein when the computer program is executed by a processor of a computer, it is used to cause the computer to perform the method according to the embodiment of the present application.

[0177] refer to Figure 5 , a block diagram of an electronic device 500 that can serve as a server or client of the present application will now be described, which is an example of a hardware device that can be applied to various aspects of the present application. The electronic device is intended to represent various forms of digital electronic computer equipment, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as personal digital processing, cellular phones, smart phones, wearable devices and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely examples and are not intended to limit the implementation of the present application described and / or required herein.

[0178] like Figure 5As shown, the electronic device 500 includes a computing unit 501, which can perform various appropriate actions and processes according to a computer program stored in a read-only memory (ROM 502) or a computer program loaded from a storage unit 508 into a random access memory (RAM 503). In the RAM 503, various programs and data required for the operation of the electronic device 500 can also be stored. The computing unit 501, the ROM 502, and the RAM 503 are connected to each other via a bus 504. An input / output interface (I / O interface 505) is also connected to the bus 504.

[0179] Multiple components within electronic device 500 are connected to I / O interface 505, including an input unit 506, an output unit 507, a storage unit 508, and a communication unit 509. Input unit 506 can be any type of device capable of inputting information into electronic device 500. Input unit 506 can receive input numeric or character information and generate key input signals related to user settings and / or function control of the electronic device. Output unit 507 can be any type of device capable of presenting information and may include, but is not limited to, a display, a speaker, a video / audio output terminal, a vibrator, and / or a printer. Storage unit 508 may include, but is not limited to, a magnetic disk or an optical disk. Communication unit 509 allows electronic device 500 to exchange information / data with other devices via computer networks such as the Internet and / or various telecommunication networks and may include, but is not limited to, a modem, a network card, an infrared communication device, a wireless communication transceiver and / or chipset, such as a Bluetooth™ device, a WiFi device, a WiMax device, a cellular communication device, and / or the like.

[0180] The computing unit 501 can be various general and / or special processing components with processing and computing capabilities. Some examples of the computing unit 501 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various dedicated artificial intelligence (AI) computing chips, various computing units that run machine learning model algorithms, digital signal processors (DSPs), and any appropriate processors, controllers, microcontrollers, etc. The computing unit 501 performs the various methods and processes described above. For example, in some embodiments, the aforementioned method for reducing carbon emissions based on K8S scheduling optimization can be implemented as a computer software program, which is tangibly contained in a machine-readable medium, such as a storage unit 508. In some embodiments, part or all of the computer program can be loaded and / or installed on the electronic device 500 via the ROM 502 and / or the communication unit 509. In some embodiments, the computing unit 501 can be configured to execute the aforementioned method for reducing carbon emissions based on K8S scheduling optimization by any other appropriate means (for example, by means of firmware).

[0181] The program code for implementing the methods of the present application can be written in any combination of one or more programming languages. Such program code can be provided to a processor or controller of a general-purpose computer, a special-purpose computer, or other programmable data processing device, so that when the program code is executed by the processor or controller, the functions / operations specified in the flow charts and / or block diagrams are implemented. The program code can be executed entirely on the machine, partially on the machine, as a stand-alone software package, partially on the machine and partially on a remote machine, or entirely on a remote machine or server.

[0182] In the context of the present application, a machine-readable medium can be a tangible medium that can contain or store a program for use by or in conjunction with an instruction execution system, system, or device. A machine-readable medium can be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium can include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, system, or device, or any suitable combination of the foregoing. A more specific example of a machine-readable storage medium can include an electrical connection based on one or more lines, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.

[0183] As used herein, the terms "machine-readable medium" and "computer-readable medium" refer to any computer program product, apparatus, and / or device (e.g., a magnetic disk, an optical disk, a memory, a programmable logic device (PLD)) for providing machine instructions and / or data to a programmable processor, including a machine-readable medium that receives machine instructions as a machine-readable signal. The term "machine-readable signal" refers to any signal for providing machine instructions and / or data to a programmable processor.

[0184] To provide interaction with a user, the systems and techniques described herein can be implemented on a computer having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and pointing device (e.g., a mouse or trackball) through which the user can provide input to the computer. Other types of devices can also be used to provide interaction with the user; for example, the feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including acoustic input, voice input, or tactile input).

[0185] The systems and techniques described herein can be implemented in a computing system that includes back-end components (e.g., as a data server), or a computing system that includes middleware components (e.g., an application server), or a computing system that includes front-end components (e.g., a user computer having a graphical user interface or a web browser through which a user can interact with implementations of the systems and techniques described herein), or a computing system that includes any combination of such back-end components, middleware components, or front-end components. The components of the system can be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include a local area network (LAN), a wide area network (WAN), and the Internet.

[0186] Computer systems may include clients and servers. A client and server are generally remote from each other and typically interact through a communication network. The client and server relationship arises through computer programs running on the respective computers and having a client-server relationship to each other.

Claims

1. A method for reducing carbon emissions based on K8S scheduling optimization, characterized in that: The method comprises: Obtain the Pod request to be scheduled and the resource and energy consumption of each worker machine. The Pod request carries the requested CPU resources and memory resources. The resource consumption includes the remaining CPU and memory, and the energy consumption includes the energy consumption of the provided hardware resources and the carbon emission intensity of the workload. Based on the CPU resources and memory resources used by the request, combined with the resource consumption and energy consumption of each worker machine, the suitability score between each worker machine and the Pod request is calculated according to a preset multi-dimensional carbon emission-aware scheduling algorithm; The preset multi-dimensional carbon emission-aware scheduling algorithm is a weighted function pre-constructed based on the ratio of resource request amount to remaining amount, energy utilization rate, and the carbon emission intensity of the workload, wherein the ratio of resource request amount to remaining amount includes: a first ratio between the CPU resource and the remaining CPU, and a second ratio between the memory resource and the remaining memory; the energy utilization rate is calculated based on the energy consumption of the provided hardware resources; According to the fitness score, a target work machine for deploying the Pod request is determined, and the Pod request is scheduled and deployed to the target work machine so that the target work machine responds to the Pod request.

2. The method according to claim 1, characterized in that The method further comprises: Obtaining a carbon emission weight factor, and determining a target work machine for deploying the Pod request based on the fitness score, including: If the carbon emission weight factor approaches 1, determining the working machine with the highest fitness score as the target working machine; If the carbon emission weight factor approaches 0, the working machine having the fitness score higher than a preset fitness score threshold is determined as the target working machine.

3. The method according to claim 1, characterized in that The preset multi-dimensional carbon emission-aware scheduling algorithm satisfies the following formula: S=α×(Resourcerequested / Resourceremaining)+β×Eefficiency+γ×(1 / Cintensity) Among them, S is the fitness score, Resourcerequested / Resourceremaining is the ratio of the resource request amount to the remaining amount, α is the weight coefficient of the ratio of the resource request amount to the remaining amount, Eefficiency is the energy utilization rate, β is the weight coefficient of the energy utilization rate, Cintensity is the carbon emission intensity of the workload, γ is the weight coefficient of the carbon emission intensity of the workload, and α+β+γ=1.

4. The method according to claim 1, wherein The energy utilization rate is calculated by the following formula: Eefficiency=Energyconsumed / ? Resourceprovided Among them, Resourceprovided is the provided hardware resources, and the hardware resources include: the number of CPU cores, memory capacity, and storage read and write speed provided by the working machine; Energyconsumed is the energy consumption of the provided hardware resources.

5. The method according to claim 1, characterized in that The method is applied to the K8S scheduler, and the method further includes: Obtaining the energy consumption of the provided hardware resources through a first communication interface with a smart meter of each of the working machines at a preset time interval, or obtaining the energy consumption of the provided hardware resources through a second communication interface with a hardware power consumption management module of each of the working machines; The workload carbon emission intensity is obtained through a third communication interface with the carbon emission accounting system.

6. The method according to claim 5, characterized in that The method further comprises: Performing data cleaning and outlier processing on the energy consumption of the provided hardware resources and the carbon emission intensity of the workload; The fitness score between each of the working machines and the Pod request is calculated based on the data cleaning, the energy consumption after the outlier processing, and the workload carbon emission intensity.

7. A system for reducing carbon emissions based on K8S scheduling optimization, characterized in that: The system includes: a K8S scheduler, a carbon emission data collection module, and a carbon emission analysis and decision module; wherein: The K8S scheduler is used to obtain a Pod request to be scheduled, where the Pod request carries the requested CPU resources and memory resources; The carbon emission data collection module is used to obtain the resource consumption and energy consumption of each working machine. The resource consumption includes: remaining CPU and remaining memory; the energy consumption includes: energy consumption of provided hardware resources and workload carbon emission intensity; The carbon emission analysis and decision module is used to calculate the fitness score between each of the worker machines and the Pod request based on the CPU resources and memory resources used by the request, combined with the resource consumption and energy consumption of each of the worker machines, in accordance with a preset multi-dimensional carbon emission-aware scheduling algorithm; The preset multi-dimensional carbon emission-aware scheduling algorithm is a weighted function pre-constructed based on the ratio of resource request amount to remaining amount, energy utilization rate, and the carbon emission intensity of the workload, wherein the ratio of resource request amount to remaining amount includes: a first ratio between the CPU resource and the remaining CPU, and a second ratio between the memory resource and the remaining memory; the energy utilization rate is calculated based on the energy consumption of the provided hardware resources; The K8S scheduler is further used to determine the target work machine for deploying the Pod request based on the fitness score, and schedule and deploy the Pod request to the target work machine so that the target work machine responds to the Pod request.

8. The system according to claim 7, characterized in that The K8S scheduler is also used to: Obtaining a carbon emission weight factor, and determining a target work machine for deploying the Pod request based on the fitness score, including: If the carbon emission weight factor approaches 1, determining the working machine with the highest fitness score as the target working machine; If the carbon emission weight factor approaches 0, the working machine having the fitness score higher than a preset fitness score threshold is determined as the target working machine.

9. An electronic device, characterized in that: The electronic device comprises: a processor and a memory storing a program; wherein the program comprises instructions, and when the instructions are executed by the processor, the processor is caused to perform the method according to any one of claims 1 to 6.

10. A non-transitory computer-readable storage medium storing computer instructions, characterized in that: The computer instructions are used to enable a computer to execute the method according to any one of claims 1 to 6.