Resource adjustment method, related equipment and storage medium
Through the collaborative work of the ebpf detection component and the alarm analysis component, the resource adjustment strategy is automatically generated and implemented, which solves the problem of low resource adjustment efficiency caused by manual analysis in the existing technology, and realizes efficient system resource management.
Patent Information
- Application Number
- CN202211720520.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-12-30
- Publication Date
- 2025-09-02
- Estimated Expiration
- 2042-12-30
AI Technical Summary
After receiving the alarm information, existing operating systems need to manually analyze and manually expand the system, resulting in low resource adjustment efficiency.
The ebpf detection component is used to obtain the target operation data of the K8S cluster subsystem, and send it to the alarm analysis component when it meets the preset conditions. The alarm analysis component generates a resource adjustment strategy, and the K8S cluster subsystem is automatically adjusted through the K8S control component.
It realizes automatic system expansion without manual intervention, and improves the efficiency of resource adjustment.
Smart Images

Figure CN116244071B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of artificial intelligence technology, and in particular to a resource adjustment method, related equipment, and storage medium. Background Art
[0002] In existing operating systems, after receiving an alarm message, operation and maintenance personnel and R&D personnel often analyze the problem, determine whether scaling is necessary, and then manually perform scaling.
[0003] Manual system expansion and contraction requires manual analysis of the problem, and then expansion and contraction are performed based on the results of the manual analysis, resulting in low efficiency in system resource adjustment. Summary of the Invention
[0004] The embodiments of the present application provide a resource adjustment method, related equipment and storage medium, which can improve the efficiency of system resource adjustment.
[0005] In a first aspect, an embodiment of the present application provides a resource adjustment method, which is applied to a resource adjustment system. The resource adjustment system includes an eBPF detection component, an alarm analysis component, a K8S control component, and a K8S cluster subsystem. The method includes:
[0006] The ebpf detection component obtains the current target operation data of the K8S cluster subsystem, and when the target operation data meets the preset conditions, sends the target operation data to the alarm analysis component;
[0007] The alarm analysis component generates a target resource adjustment strategy based on the target operation data, the current number of instances running in the K8S cluster subsystem, and the number of idle resources of the resource adjustment system, and sends the target resource adjustment strategy to the K8S control component;
[0008] The K8S control component adjusts resources of the K8S cluster subsystem according to the target resource adjustment strategy.
[0009] In a second aspect, an embodiment of the present application further provides a resource adjustment system, which includes an eBPF detection component, an alarm analysis component, a K8S control component, and a K8S cluster subsystem, wherein:
[0010] The ebpf detection component is used to obtain the current target operation data of the K8S cluster subsystem, and when the target operation data meets the preset conditions, send the target operation data to the alarm analysis component;
[0011] The alarm analysis component is used to generate a target resource adjustment strategy based on the target operation data, the current number of instances running in the K8S cluster subsystem, and the number of idle resources of the resource adjustment system, and send the target resource adjustment strategy to the K8S control component;
[0012] The K8S control component is used to adjust the resources of the K8S cluster subsystem according to the target resource adjustment strategy.
[0013] In some embodiments, the preset condition includes an expansion condition or a contraction condition.
[0014] In some embodiments, when the target operating data meets the expansion condition; the alarm analysis component, when executing the step of generating a target resource adjustment strategy based on the target operating data, the current number of instances running in the K8S cluster subsystem, and the number of idle resources in the resource adjustment system, is specifically used to:
[0015] If the amount of idle resources is greater than a preset first resource threshold, generating a first resource expansion strategy according to the target operation data and a preset first resource expansion rule;
[0016] If the number of idle resources is less than or equal to the first resource threshold, and the current number of instances is less than a preset first instance threshold, determining a first target number of instances corresponding to the target operating data according to a preset correspondence between operating data and instance numbers, and generating an instance expansion strategy based on the first target number of instances and the current number of instances;
[0017] If the current number of instances is greater than or equal to the first instance threshold, and the current number of idle resources is greater than the preset second resource threshold and less than or equal to the first resource threshold, a second resource expansion strategy is generated according to the target operation data and the preset second resource expansion rule.
[0018] In some embodiments, the resource adjustment system further includes an access control component:
[0019] The alarm analysis component is further configured to send an access policy startup instruction to the access control component if the number of idle resources is less than or equal to the second resource threshold and the number of current instances is greater than or equal to the first instance threshold;
[0020] The access control component is used to activate a preset access policy in response to the access policy activation instruction.
[0021] In some embodiments, after executing the step of initiating a preset access policy in response to the access policy initiation instruction, the access control component is further configured to:
[0022] Receive an access request from a user terminal, the access request carrying a target user identifier of the target user; if the target user identifier exists in the identifier set of the access policy, allow the user access request to pass; if the target user identifier does not exist in the identifier set of the access policy, deny the user access request to pass.
[0023] In some embodiments, when the target operating data meets the scaling-down condition, the alarm analysis component, when executing the step of generating a target resource adjustment strategy based on the target operating data, the current number of instances running in the K8S cluster subsystem, and the number of idle resources in the resource adjustment system, is specifically used to:
[0024] If the amount of idle resources is less than a preset third resource threshold, generating a first resource scaling-down strategy according to the target operation data and a preset first resource scaling-down rule;
[0025] If the number of idle resources is greater than or equal to the third resource threshold, and the current number of instances is greater than a preset second instance threshold, determining a second target number of instances corresponding to the target operating data according to a preset correspondence between operating data and instance numbers, and generating an instance scaling-down strategy based on the second target number of instances and the current number of instances;
[0026] If the number of idle resources is greater than or equal to the third resource threshold and the number of current instances is less than or equal to the second instance threshold, a second resource scaling-in strategy is generated according to the target operation data and a preset second resource scaling-in rule.
[0027] In some embodiments, the target operation data includes at least one of network traffic data, memory occupancy, and CPU occupancy.
[0028] In a third aspect, an embodiment of the present application further provides a computer device, which includes a memory and a processor, wherein a computer program is stored in the memory, and the processor implements the above method when executing the computer program.
[0029] In a fourth aspect, an embodiment of the present application further provides a computer-readable storage medium, wherein the storage medium stores a computer program, wherein the computer program includes program instructions, and the program instructions can implement the above method when executed by a processor.
[0030] Compared with the prior art, the present application provides a resource adjustment method, which is applied to a resource adjustment system, and the resource adjustment system includes an ebpf detection component, an alarm analysis component, a K8S control component, and a K8S cluster subsystem; on the one hand, the ebpf detection component in the resource adjustment system can obtain the current target operation data of the K8S cluster subsystem, and when the target operation data meets the preset conditions, the target operation data will be sent to the alarm analysis component, and the alarm analysis component will generate a target resource adjustment strategy. It can be seen that through this application, the alarm analysis component can automatically analyze the expansion and contraction of the system; on the other hand, after the alarm analysis component in this embodiment obtains the target resource adjustment strategy, it will send the target resource adjustment strategy to the K8S control component, and the K8S control component will adjust the resources of the K8S cluster subsystem according to the target resource adjustment strategy. It can be seen that through this application, the resources of the K8S cluster subsystem can be automatically adjusted without the need for division of labor analysis and manual resource adjustment, thereby improving the efficiency of system resource adjustment. BRIEF DESCRIPTION OF THE DRAWINGS
[0031] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the following is a brief introduction to the drawings required for use in the description of the embodiments. Obviously, the drawings described below are some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without any creative work.
[0032] Figure 1 A schematic diagram of a framework of a resource adjustment system provided in an embodiment of the present application;
[0033] Figure 2 A flowchart of a resource adjustment method provided in an embodiment of the present application;
[0034] Figure 3 A schematic block diagram of a resource adjustment system provided in an embodiment of the present application;
[0035] Figure 4 A schematic block diagram of a resource adjustment system provided in another embodiment of the present application;
[0036] Figure 5 This is a schematic diagram of the structure of a terminal in an embodiment of the present application;
[0037] Figure 6 This is a structural diagram of a server in an embodiment of the present application. DETAILED DESCRIPTION
[0038] The terms "first", "second", etc. in the description and claims of the embodiments of the present application and the above-mentioned drawings are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchanged where appropriate so that the embodiments described herein can be implemented in an order other than that shown or described herein. In addition, the terms "including" and "having" and any of their variations are intended to cover non-exclusive inclusions. For example, a process, method, system, product or device that includes a series of steps or modules is not necessarily limited to those steps or modules clearly listed, but may include other steps or modules that are not clearly listed or inherent to these processes, methods, products or devices. The division of modules that appears in the embodiments of the present application is only a logical division. In actual applications, there may be other division methods when implementing, for example, multiple modules can be combined into or integrated into another system, or some features can be ignored or not executed. In addition, the coupling or direct coupling or communication connection between each other shown or discussed can be through some interfaces, and the indirect coupling or communication connection between modules can be electrical or other similar forms, which are not limited in the embodiments of the present application. Moreover, the modules or sub-modules described as separate components may or may not be physically separated, may or may not be physical modules, or may be distributed into multiple circuit modules, and some or all of the modules may be selected according to actual needs to achieve the purpose of the embodiment of the present application.
[0039] The embodiments of the present application provide a resource adjustment method, related equipment and storage medium. The execution subject of the resource adjustment method can be the resource adjustment system provided in the embodiments of the present application, or a computer device integrated with the resource adjustment system, wherein the resource adjustment system can be implemented in hardware or software, and the computer device can be a terminal or a server.
[0040] When the computer device is a server, the server can be an independent physical server, a server cluster or distributed system composed of multiple physical servers, or a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, CDN, as well as big data and artificial intelligence platforms.
[0041] When the computer device is a terminal, the terminal may include: smart phones, tablet computers, laptop computers, desktop computers, smart TVs, smart speakers, personal digital assistants (English full name: Personal Digital Assistant, English abbreviation: PDA), desktop computers, smart watches and other smart terminals with multimedia data processing functions (for example, video data playback function, music data playback function), but is not limited to these.
[0042] The solutions of the embodiments of the present application can be implemented based on artificial intelligence technology, specifically involving the technical field of computer vision technology in artificial intelligence technology and the fields of cloud computing, cloud storage and database in cloud technology, which will be introduced below respectively.
[0043] Artificial Intelligence (AI) refers to the theories, methods, techniques, and application systems that use digital computers or machines controlled by digital computers to simulate, extend, and expand human intelligence, to perceive the environment, acquire knowledge, and use that knowledge to achieve optimal results. In other words, AI is a comprehensive technology within computer science that seeks to understand the essence of intelligence and produce new intelligent machines that can respond in a manner similar to human intelligence. AI also involves studying the design principles and implementation methods of various intelligent machines, enabling them to possess the capabilities of perception, reasoning, and decision-making.
[0044] Artificial intelligence (AI) technology is a comprehensive discipline encompassing a wide range of fields, encompassing both hardware and software technologies. Foundational AI technologies generally include sensors, specialized AI chips, cloud computing, distributed storage, big data processing, operating / interaction systems, and mechatronics. AI software technologies primarily encompass computer vision, speech processing, natural language processing, and machine learning / deep learning.
[0045] Computer vision (CV) is the science of making machines "see." Specifically, it refers to machine vision, where cameras and computers replace the human eye in identifying, tracking, and measuring objects. This involves further processing the images, transforming them into images more suitable for human observation or transmission to instruments. As a scientific discipline, computer vision studies related theories and technologies, attempting to build artificial intelligence systems capable of extracting information from images or multidimensional data. Computer vision technologies typically include image processing, facial recognition, image semantic understanding, image retrieval, optical character recognition (OCR), video processing, video semantic understanding, video content / behavior recognition, three-dimensional object reconstruction, 3D technology, virtual reality, augmented reality, simultaneous localization and mapping, and other technologies. It also includes common biometric recognition technologies such as facial recognition and fingerprint recognition.
[0046] With the research and advancement of artificial intelligence technology, artificial intelligence technology has been studied and applied in many fields, such as common smart homes, smart wearable devices, virtual assistants, smart speakers, smart marketing, unmanned driving, autonomous driving, drones, robots, smart medical care, smart customer service, etc. It is believed that with the development of technology, artificial intelligence technology will be applied in more fields and play an increasingly important role.
[0047] The solutions of the embodiments of the present application can be implemented based on cloud technology, and specifically involve technical fields such as cloud computing, cloud storage, and database in cloud technology, which will be introduced below.
[0048] Cloud technology refers to a hosting technology that unifies a series of resources such as hardware, software, and network within a wide area network or local area network to realize the calculation, storage, processing, and sharing of data. Cloud technology is a general term for network technology, information technology, integration technology, management platform technology, application technology, etc. based on the cloud computing business model. It can form a resource pool that can be used on demand and is flexible and convenient. Cloud computing technology will become an important support. The background services of technical network systems require a large amount of computing and storage resources, such as video websites, image websites, and more portal websites. With the rapid development and application of the Internet industry, each item may have its own identification mark in the future, and all need to be transmitted to the background system for logical processing. Data of different levels will be processed separately, and all types of industry data require strong system backing support, which can only be achieved through cloud computing. The embodiment of the present application can save the recognition results through cloud technology.
[0049] Cloud storage is a new concept that extends and develops from the concept of cloud computing. A distributed cloud storage system (hereinafter referred to as a storage system) is a storage system that uses cluster applications, grid technology, and distributed storage file systems to bring together a large number of different types of storage devices (also known as storage nodes) on a network through application software or application interfaces to work together and provide external data storage and service access functions. In the embodiments of this application, network configuration and other information can be stored in the storage system for easy access by the server.
[0050] Currently, storage systems utilize a method for creating logical volumes. When creating a logical volume, physical storage space is allocated for each logical volume. This physical storage space may consist of disks on a specific storage device or several storage devices. When a client stores data on a logical volume, it stores the data on a file system. The file system divides the data into multiple parts, each of which is an object. An object contains not only the data but also additional information such as the data identifier (ID) of the data entity. The file system writes each object to the physical storage space of the logical volume and records the storage location information of each object. Therefore, when a client requests access to data, the file system can provide access to the data based on the storage location information of each object.
[0051] The storage system allocates physical storage space to logical volumes by pre-dividing the physical storage space into stripes based on the estimated capacity of the objects to be stored in the logical volume (this estimate often has a large margin relative to the actual capacity of the objects to be stored) and the Redundant Array of Independent Disks (RAID) groupings. A logical volume can be understood as a stripe, thereby allocating physical storage space to the logical volume.
[0052] A database, in short, can be thought of as a digital filing cabinet—a place where electronic files are stored, allowing users to add, query, update, and delete data. A database is a collection of data stored in a specific way, shared by multiple users, with minimal redundancy, and independent of applications.
[0053] A database management system (DBMS) is a computer software system designed for managing databases, and generally has basic functions such as storage, interception, security, and backup. Database management systems can be classified according to the database models they support, such as relational, XML (Extensible Markup Language); or according to the types of computers they support, such as server clusters and mobile phones; or according to the query language used, such as SQL (Structured Query Language) and XQuery; or according to performance focus, such as maximum scale and maximum operating speed; or other classification methods. Regardless of the classification method used, some DBMSs can cross categories, for example, supporting multiple query languages at the same time. In an embodiment of the present application, the recognition results can be stored in the database management system for easy retrieval by the server.
[0054] It should be noted that the service terminal involved in the embodiments of the present application may refer to a device that provides voice and / or data connectivity to the service terminal, a handheld device with wireless connection capabilities, or other processing devices connected to a wireless modem. For example, a mobile phone (or "cellular" phone) and a computer with a mobile terminal, for example, a portable, pocket-sized, handheld, computer-built-in, or vehicle-mounted mobile device that exchanges voice and / or data with a wireless access network. For example, a Personal Communication Service (PCS) phone, a cordless phone, a Session Initiation Protocol (SIP) phone, a Wireless Local Loop (WLL) station, a Personal Digital Assistant (PDA), and other devices.
[0055] See also Figure 1 , Figure 1 A schematic diagram of the framework of the resource adjustment system provided in an embodiment of the present application. The resource adjustment system includes an extended Berkeley Packet Filter (eBPF) detection component 10, an alarm analysis component 20, a K8S (Kubernetes) control component 30, and a K8S cluster subsystem 40 (a running system), wherein:
[0056] The ebpf detection component 10 obtains the current target operation data of the K8S cluster subsystem, and when the target operation data meets the preset conditions, sends the target operation data to the alarm analysis group 20; the alarm analysis component 20 generates a target resource adjustment policy based on the target operation data, the current number of instances running in the K8S cluster subsystem, and the number of idle resources of the resource adjustment system, and sends the target resource adjustment policy to the K8S control component 30; the K8S control component 30 adjusts the resources of the K8S cluster subsystem 40 according to the target resource adjustment policy.
[0057] Figure 2 This is a flow chart of the resource adjustment method provided in the embodiment of the present application. Figure 1 The resource adjustment system shown in Figure 2 As shown, the method includes the following steps S110-S150.
[0058] S110. The ebpf detection component obtains the current target operation data of the K8S cluster subsystem.
[0059] In this embodiment, the ebpf detection component can obtain the current target operation data of the K8S cluster subsystem non-invasively.
[0060] The target operation data includes at least one of network traffic data, memory occupancy rate and CPU occupancy rate.
[0061] S120. When the target operation data meets a preset condition, the eBPF detection component sends the target operation data to the alarm analysis component.
[0062] In this embodiment, in order to enable the resource adjustment system in this embodiment to not only monitor the expansion of the K8S cluster subsystem, but also monitor the reduction of the K8S cluster subsystem in order not to waste resources, the preset conditions include expansion conditions and reduction conditions. The expansion conditions are used to monitor the expansion of the K8S cluster subsystem, and the reduction conditions are used to monitor the reduction of the K8S cluster subsystem.
[0063] The expansion condition is: network traffic data is greater than a preset first traffic threshold, memory usage is greater than a preset first memory usage threshold, or CPU usage is greater than a preset first CPU usage threshold.
[0064] For example, the first traffic threshold can be 1G / s, the first memory occupancy threshold is 50%, and the first CPU occupancy threshold is 60%. It should be noted that the first traffic threshold, the first memory occupancy threshold and the first CPU occupancy threshold can also be set to other values as needed, and are not limited here.
[0065] At this time, when the ebpf detection component detects that the network traffic data in the target operation data is greater than the preset first traffic threshold, the memory occupancy rate is greater than the preset first memory occupancy threshold, or the CPU occupancy rate is greater than the preset first CPU occupancy threshold, the acquired target operation data will be sent to the alarm analysis component.
[0066] The scaling-down condition is: network traffic data is less than a preset second traffic threshold, memory usage is less than a preset second memory usage threshold, or CPU usage is less than a preset second CPU usage threshold.
[0067] For example, the second traffic threshold can be 10M / s, the second memory occupancy threshold is 10%, and the first CPU occupancy threshold is 10%. It should be noted that the second traffic threshold, the second memory occupancy threshold and the second CPU occupancy threshold can also be set to other values as needed, and are not limited here.
[0068] At this time, when the eBPF detection component detects that the network traffic data in the target operation data is less than the preset second traffic threshold, the memory occupancy rate is less than the preset second memory occupancy threshold, or the CPU occupancy rate is less than the preset second CPU occupancy threshold, the acquired target operation data is sent to the alarm analysis component.
[0069] S130. The alarm analysis component generates a target resource adjustment strategy based on the target operation data, the current number of instances running in the K8S cluster subsystem, and the number of idle resources of the resource adjustment system.
[0070] In this embodiment, after the alarm analysis component obtains the target operation data sent by the ebpf detection component, it will further determine whether to expand or shrink the K8S cluster subsystem based on the obtained target operation data. If the target operation data meets the expansion conditions, the K8S cluster subsystem needs to be expanded. If the target operation data meets the shrinkage conditions, the K8S cluster subsystem needs to be shrunk.
[0071] In some embodiments, when the target operating data meets the expansion conditions, in order to automatically expand the K8S cluster subsystem, the alarm analysis component needs to generate an expansion strategy corresponding to the current K8S cluster subsystem. At this time, it is also necessary to further obtain the current number of instances running in the K8S cluster subsystem and the number of idle resources of the resource adjustment system.
[0072] Among them, the current number of instances running in the K8S cluster subsystem in this application and the number of idle resources of the resource adjustment system can be obtained by monitoring the resource adjustment system through the ebpf detection component.
[0073] Specifically, in some embodiments, in order to accurately expand the capacity of the K8S cluster subsystem, when the target operating data meets the expansion conditions, the alarm analysis component generates a target resource adjustment policy through the following steps, including step A1, step B1, and step C1:
[0074] Step A1: If the amount of idle resources is greater than a preset first resource threshold, a first resource expansion strategy is generated according to the target operation data and a preset first resource expansion rule.
[0075] First, determine whether the number of idle resources is greater than a preset first resource threshold, wherein the first resource threshold can be 10 or other numbers. The specific number can be adjusted according to demand and is not limited here.
[0076] If the number of idle resources is greater than the preset first resource threshold, it means that the idle resources can be used to expand the K8S cluster subsystem. At this time, it is necessary to generate a first resource expansion strategy based on the target operation data and the preset first resource expansion rule.
[0077] The resources in this embodiment include memory resources, CPU resources or disk resources.
[0078] In some embodiments, the first resource expansion rule includes a correspondence between operating data and the number of resource expansions, for example, a correspondence between network traffic and the number of resource expansions. At this time, the target resource expansion number is determined based on the network traffic data in the target operating data and the above correspondence, and the resource address of the target idle resources that can be expanded by the target resource is determined from the idle resources. A first resource expansion strategy is generated based on the resource address so that the resource address configuration can be added to the instance running in the K8S cluster subsystem in the future. For example, according to the resource configuration, the current instance is deployed on 3 machines. After resource expansion, 2 resource addresses are added to the instance configuration of the K8S cluster subsystem so that the current instance is deployed on 5 machines.
[0079] Step B1. If the number of idle resources is less than or equal to the first resource threshold, and the current number of instances is less than the preset first instance threshold, the first target number of instances corresponding to the target operating data is determined based on the preset correspondence between the operating data and the number of instances, and an instance expansion strategy is generated based on the first target number of instances and the current number of instances.
[0080] In this embodiment, when it is determined that the number of idle resources is less than or equal to the first resource threshold, and the current number of instances is less than the preset first instance threshold, it is necessary to determine the first target instance number corresponding to the target operating data based on the correspondence between the preset operating data and the number of instances, and generate an instance expansion strategy based on the first target instance number and the current number of instances.
[0081] The first instance threshold may be 20 or other values. The specific value may be set according to actual needs and is not limited here.
[0082] Specifically, in this embodiment, a correspondence between operating data and the number of instances is preset, such as the correspondence between network traffic and the number of instances. At this time, the first target number of instances is determined based on the network traffic data in the target operating data and the correspondence between network traffic and the number of instances. The first target number of instances is the ideal number of instances running in the current K8S cluster subsystem.
[0083] Then, an instance expansion strategy is generated based on the first target number of instances and the current number of instances. For example, if the first target number of instances is 22 and the current number of instances is 18, the instance expansion strategy generated at this time is: add 4 running instances in the K8S cluster subsystem.
[0084] Step C1: If the current number of instances is greater than or equal to the first instance threshold, and the current number of idle resources is greater than the preset second resource threshold and less than or equal to the first resource threshold, a second resource expansion strategy is generated according to the target operation data and the preset second resource expansion rule.
[0085] In this embodiment, when it is determined that the current number of instances is greater than or equal to the first instance threshold, and the current number of idle resources is greater than the preset second resource threshold and less than or equal to the first resource threshold, this indicates that the number of instances currently running in the K8S cluster subsystem is sufficient, and although the current number of idle resources in the system is less than or equal to the first resource threshold, it is greater than the second resource number. At this time, the idle resources can also be called.
[0086] Among them, the second resource threshold is smaller than the first resource threshold. The second resource threshold can be 5 or other numbers. The specific number can be adjusted according to demand and is not limited here.
[0087] In some embodiments, the second resource expansion rule includes a correspondence between operating data and resource expansion quantities, for example, a correspondence between network traffic and resource expansion quantities. Compared with the correspondence between network traffic and resource expansion quantities in the first resource expandable rule, the resource expansion quantity corresponding to the same network traffic data in the second resource expansion rule is smaller.
[0088] For example, for the same network traffic data, the target resource expansion quantity determined according to the first resource expansion rule is 2, while the target resource expansion quantity determined according to the second resource expansion rule is 1.
[0089] At this time, the target resource expansion quantity is determined based on the network traffic data in the target operation data and the above-mentioned correspondence, and the resource address of the target idle resources by which the target resources can be expanded is determined from the idle resources. Based on the resource address, a second resource expansion strategy is generated so that the resource address configuration can be added to the instances running in the K8S cluster subsystem in the future to realize the expansion of the K8S cluster subsystem.
[0090] It should be noted that when the number of idle resources is less than or equal to the second resource threshold, and the current number of instances is greater than or equal to the first instance threshold, this indicates that the current number of idle resources in the system is already critical, and the current number of instances is already relatively large. In order to avoid system crashes, it is necessary to control the system's access volume from the front end. In this embodiment, the resource adjustment system also includes an access control component, and the method also includes: if the number of idle resources is less than or equal to the second resource threshold, and the current number of instances is greater than or equal to the first instance threshold, an access policy startup instruction is sent to the access control component.
[0091] In this embodiment, after the access control component is started, the access control component will determine whether to accept the access request based on the target user identifier of the received access request, and implement filtering of the access request, which specifically includes the following steps: the access control component receives an access request from a user terminal, wherein the access request carries the target user identifier of the target user; if the target user identifier exists in the identifier set of the access policy, the access control component allows the user access request to pass; if the target user identifier does not exist in the identifier set of the access policy, the access control component rejects the user access request to pass.
[0092] It can be seen that through this solution, when it is found that the number of idle resources is less than or equal to the second resource threshold and the number of current instances is greater than or equal to the first instance threshold, in order to avoid system overload and crash, this application can also filter access requests.
[0093] Specifically, in some embodiments, in order to accurately scale down the K8S cluster subsystem and reduce system operating costs, when the target operating data meets the scaling conditions, the alarm analysis component generates a target resource adjustment policy through the following steps, including step A2, step B2, and step C2:
[0094] Step A2: If the amount of idle resources is less than a preset third resource threshold, a first resource reduction strategy is generated according to the target operation data and a preset first resource reduction rule.
[0095] In this embodiment, if the number of idle resources is less than the third resource threshold, it means that the number of idle resources in the system is relatively small at this time. If the K8S cluster subsystem needs to be scaled down, the release of resources needs to be prioritized.
[0096] Specifically, in some embodiments, the first resource scaling rule includes a correspondence between operating data and the number of resource reductions, such as a correspondence between network traffic and the number of resource reductions. At this time, the target resource reduction number is determined based on the network traffic data in the target operating data and the above correspondence, and the first resource scaling strategy is generated based on the target resource reduction number. For example, the first resource scaling strategy is to reduce two resource amounts, that is, to reduce the configuration of two machines for the currently running instance. For example, the original instance was deployed on 5 machines. After scaling down, the instance resource configuration is changed so that the currently running instance is deployed on 3 machines.
[0097] Step B2: If the number of idle resources is greater than or equal to the third resource threshold, and the current number of instances is greater than the second instance threshold, the second target number of instances corresponding to the target operating data is determined based on the preset correspondence between the operating data and the number of instances, and an instance scaling strategy is generated based on the second target number of instances and the current number of instances.
[0098] In this embodiment, if the number of idle resources is greater than or equal to the third resource threshold (wherein the third resource threshold is greater than the above-mentioned first resource threshold), it means that the current number of idle resources is large. At this time, you can further consider whether to scale down the instance. If the current number of instances is greater than the second instance threshold, it means that the current number of instances is large, and you can consider scaling down the number of instances.
[0099] For example, the preset correspondence between operating data and the number of instances includes the correspondence between network traffic and the number of instances. At this time, the second target number of instances is determined based on the network traffic data of the target operating data and the above correspondence, wherein the second target number of instances is the number of operating instances that is compatible with the current system.
[0100] The alarm analysis component then generates an instance scaling-down strategy based on the second target instance number and the current instance number. For example, if the second target instance number is 28 and the current instance number is 31, the instance scaling-up strategy generated is: reduce 3 running instances in the K8S cluster subsystem.
[0101] The second example threshold may be 30 or other values. The specific value may be set according to actual needs and is not limited here.
[0102] Step C2: If the number of idle resources is greater than or equal to the third resource threshold and the number of current instances is less than or equal to the preset second instance threshold, a second resource scaling strategy is generated according to the target operation data and the preset second resource scaling rule.
[0103] Specifically, in this embodiment, if the number of idle resources is greater than or equal to the third resource threshold and the current number of instances is less than or equal to the preset second instance threshold, it means that at this time, the number of idle resources is large and the number of running instances is not large. At this time, the number of instances is maintained, and the resources in the K8S cluster subsystem are prioritized for scaling down.
[0104] The second resource scaling rule includes the correspondence between operating data and the number of resource reductions, such as the correspondence between network traffic and the number of resource reductions. Compared with the first resource scaling strategy, for the same operating data, the scaling force in the second resource scaling strategy is smaller. For example, for the same network traffic data, under the first resource scaling strategy, the configuration of two machines needs to be reduced, while under the second resource scaling strategy, only the configuration of one machine needs to be reduced.
[0105] S140. The alarm analysis component sends the target resource adjustment policy to the K8S control component.
[0106] In this embodiment, after the alarm analysis component obtains the target resource adjustment policy, it sends the target resource adjustment policy to the K8S control component. The K8S control component can access the application program interface (API) of the K8S cluster subsystem and adjust the resources of the K8S cluster subsystem through the API.
[0107] S150. The K8S control component adjusts resources of the K8S cluster subsystem according to the target resource adjustment strategy.
[0108] In this embodiment, the K8S control component adjusts the resources of the K8S cluster subsystem according to the acquired target resource adjustment strategy.
[0109] Specifically, if the target resource adjustment strategy is a resource expansion strategy (the first resource expansion strategy or the second resource expansion strategy), the resource configuration of the instance in the K8S cluster subsystem is modified according to the resource expansion strategy, and the configured resource address is increased so that the instance in the K8S cluster subsystem can enjoy more machine resources.
[0110] If the target resource adjustment strategy is the instance expansion strategy, you need to increase the number of instances deployed in the K8S cluster subsystem.
[0111] If the target resource adjustment strategy is a resource shrinkage strategy (the first resource shrinkage strategy or the second resource shrinkage strategy), the resource configuration of the instance in the K8S cluster subsystem is modified according to the resource shrinkage strategy, the configured resource address is reduced, and the machine resources used by the instance in the K8S cluster subsystem are reduced.
[0112] If the target resource adjustment policy is the instance scaling-in policy, you need to reduce the number of instances deployed in the K8S cluster subsystem.
[0113] To sum up, on the one hand, the ebpf detection component in the resource adjustment system can obtain the current target operation data of the K8S cluster subsystem, and when the target operation data meets the preset conditions, the target operation data will be sent to the alarm analysis component, and the alarm analysis component will generate a target resource adjustment strategy. It can be seen that through this application, the alarm analysis component can automatically analyze the expansion and contraction of the system; on the other hand, after the alarm analysis component in this embodiment obtains the target resource adjustment strategy, it will send the target resource adjustment strategy to the K8S control component, and the K8S control component will adjust the resources of the K8S cluster subsystem according to the target resource adjustment strategy. It can be seen that through this application, the resources of the K8S cluster subsystem can be automatically adjusted without the need for division of labor analysis and manual resource adjustment, thereby improving the efficiency of system resource adjustment.
[0114] Figure 3 This is a schematic block diagram of a resource adjustment system provided by an embodiment of the present application. Figure 3 As shown, corresponding to the above resource adjustment method, the present application also provides a resource adjustment system. The resource adjustment system includes a unit for executing the above resource adjustment method, and the device can be configured in a desktop computer, tablet computer, laptop computer, etc. Specifically, please refer to Figure 3 The resource adjustment system 300 includes an ebpf detection component 301, an alarm analysis component 302, a K8S control component 303, and a K8S cluster subsystem 304, wherein:
[0115] The eBPF detection component 301 is used to obtain the current target operation data of the K8S cluster subsystem 304, and when the target operation data meets the preset conditions, send the target operation data to the alarm analysis component 302;
[0116] The alarm analysis component 302 is used to generate a target resource adjustment policy based on the target operation data, the current number of instances running in the K8S cluster subsystem 304, and the number of idle resources of the resource adjustment system, and send the target resource adjustment policy to the K8S control component 303;
[0117] The K8S control component 303 is used to adjust the resources of the K8S cluster subsystem 304 according to the target resource adjustment strategy.
[0118] In some embodiments, the preset condition includes an expansion condition or a contraction condition.
[0119] In some embodiments, when the target operating data meets the expansion condition, the alarm analysis component 302, when executing the step of generating a target resource adjustment strategy based on the target operating data, the current number of instances running in the K8S cluster subsystem 304, and the number of idle resources of the resource adjustment system, is specifically used to:
[0120] If the amount of idle resources is greater than a preset first resource threshold, generating a first resource expansion strategy according to the target operation data and a preset first resource expansion rule;
[0121] If the number of idle resources is less than or equal to the first resource threshold, and the current number of instances is less than a preset first instance threshold, determining a first target number of instances corresponding to the target operating data according to a preset correspondence between operating data and instance numbers, and generating an instance expansion strategy based on the first target number of instances and the current number of instances;
[0122] If the current number of instances is greater than or equal to the first instance threshold, and the current number of idle resources is greater than the preset second resource threshold and less than or equal to the first resource threshold, a second resource expansion strategy is generated according to the target operation data and the preset second resource expansion rule.
[0123] In some embodiments, see Figure 4 The resource adjustment system further includes an access control component 305:
[0124] At this time, the alarm analysis component 302 is further configured to send an access policy startup instruction to the access control component 305 if the number of idle resources is less than or equal to the second resource threshold and the number of current instances is greater than or equal to the first instance threshold;
[0125] The access control component 305 is configured to activate a preset access policy in response to the access policy activation instruction.
[0126] In some embodiments, after executing the step of initiating a preset access policy in response to the access policy initiation instruction, the access control component 305 is further configured to:
[0127] Receive an access request from a user terminal, the access request carrying a target user identifier of the target user; if the target user identifier exists in the identifier set of the access policy, allow the user access request to pass; if the target user identifier does not exist in the identifier set of the access policy, deny the user access request to pass.
[0128] In some embodiments, when the target operating data meets the scaling-down condition, the alarm analysis component 302, when executing the step of generating a target resource adjustment strategy based on the target operating data, the current number of instances running in the K8S cluster subsystem 304, and the number of idle resources of the resource adjustment system, is specifically used to:
[0129] If the amount of idle resources is less than a preset third resource threshold, generating a first resource scaling-down strategy according to the target operation data and a preset first resource scaling-down rule;
[0130] If the number of idle resources is greater than or equal to the third resource threshold, and the current number of instances is greater than a preset second instance threshold, determining a second target number of instances corresponding to the target operating data according to a preset correspondence between operating data and instance numbers, and generating an instance scaling-down strategy based on the second target number of instances and the current number of instances;
[0131] If the number of idle resources is greater than or equal to the third resource threshold and the number of current instances is less than or equal to the second instance threshold, a second resource scaling-in strategy is generated according to the target operation data and a preset second resource scaling-in rule.
[0132] In some embodiments, the target operation data includes at least one of network traffic data, memory occupancy, and CPU occupancy.
[0133] In summary, on the one hand, the ebpf detection component 301 in the resource adjustment system 300 can obtain the current target operation data of the K8S cluster subsystem 304, and when the target operation data meets the preset conditions, the target operation data will be sent to the alarm analysis component 302, and the alarm analysis component 302 will generate a target resource adjustment strategy. It can be seen that through this application, the alarm analysis component 302 can automatically analyze the expansion and contraction of the system; on the other hand, after the alarm analysis component 302 in this embodiment obtains the target resource adjustment strategy, it will send the target resource adjustment strategy to the K8S control component 303, and the K8S control component 303 will adjust the resources of the K8S cluster subsystem 304 according to the target resource adjustment strategy. It can be seen that through this application, the resources of the K8S cluster subsystem 304 can be automatically adjusted without the need for division of labor analysis and manual resource adjustment, thereby improving the efficiency of system resource adjustment.
[0134] It should be noted that those skilled in the art can clearly understand that the specific implementation process of the above resource adjustment system and each unit can refer to the corresponding description in the aforementioned method embodiment. For the convenience and brevity of description, it will not be repeated here.
[0135] The resource adjustment system in the embodiment of the present application is described above from the perspective of modular functional entities. The resource adjustment system in the embodiment of the present application is described below from the perspective of hardware processing.
[0136] The present application also provides a terminal, such as Figure 5 For ease of explanation, only the parts related to the embodiments of the present application are shown. For specific technical details not disclosed, please refer to the method section of the embodiments of the present application. The terminal can be any terminal including a mobile phone, a tablet computer, a personal digital assistant (PDA), a point of sales (POS), an in-vehicle computer, etc., taking a mobile phone as an example:
[0137] Figure 5 The block diagram shows a partial structure of a mobile phone related to the terminal provided in the embodiment of the present application. Figure 5 The mobile phone includes components such as a radio frequency (RF) circuit 55, a memory 520, an input unit 530, a display unit 540, a sensor 550, an audio circuit 560, a wireless fidelity (Wi-Fi) module 570, a processor 580, and a power supply 590. Those skilled in the art will appreciate that Figure 5 The mobile phone structure shown in the figure does not constitute a limitation to the mobile phone, and may include more or fewer components than shown in the figure, or combine certain components, or arrange the components differently.
[0138] The following combination Figure 5 A detailed introduction to the various components of a mobile phone:
[0139] The RF circuitry 55 is used for transmitting and receiving information or receiving signals during calls. Specifically, it receives downlink information from the base station and transmits it to the processor 580 for processing. Furthermore, it transmits uplink data to the base station. Typically, the RF circuitry 55 includes, but is not limited to, an antenna, at least one amplifier, a transceiver, a coupler, a low-noise amplifier (LNA), a duplexer, and more. Furthermore, the RF circuitry 55 can communicate with the network and other devices via wireless communication. The above-mentioned wireless communications may use any communication standard or protocol, including but not limited to Global System of Mobile Communications (GSM), General Packet Radio Service (GPRS), Code Division Multiple Access (CDMA), Wideband Code Division Multiple Access (WCDMA), Long Term Evolution (LTE), email, Short Messaging Service (SMS), etc.
[0140] The memory 520 can be used to store software programs and modules. The processor 580 executes the various functional applications and data processing of the mobile phone by running the software programs and modules stored in the memory 520. The memory 520 may mainly include a program storage area and a data storage area. The program storage area may store an operating system and at least one application required for a function (such as a sound playback function, an image playback function, etc.); the data storage area may store data created based on the use of the mobile phone (such as audio data, a phone book, etc.). In addition, the memory 520 may include high-speed random access memory and may also include non-volatile memory, such as at least one disk storage device, a flash memory device, or other volatile solid-state storage device.
[0141] The input unit 530 can be used to receive input digital or character information, and to generate key signal input related to the user settings and function control of the mobile phone. Specifically, the input unit 530 may include a touch panel 531 and other input devices 532. The touch panel 531, also known as a touch screen, can collect user touch operations on or near it (such as operations performed by the user using any suitable object or accessory such as a finger, stylus, etc. on or near the touch panel 531) and drive the corresponding connection device according to a pre-set program. Optionally, the touch panel 531 may include two parts: a touch detection device and a touch controller. Among them, the touch detection device detects the user's touch direction and detects the signal caused by the touch operation, and transmits the signal to the touch controller; the touch controller receives the touch information from the touch detection device and converts it into touch point coordinates, which are then sent to the processor 580. It can also receive commands sent by the processor 580 and execute them. In addition, the touch panel 531 can be implemented using various types such as resistive, capacitive, infrared and surface acoustic wave. In addition to the touch panel 531, the input unit 530 may further include other input devices 532. Specifically, the other input devices 532 may include, but are not limited to, one or more of a physical keyboard, function keys (such as volume control keys, switch keys, etc.), a trackball, a mouse, and a joystick.
[0142] The display unit 540 can be used to display information input by the user or information provided to the user and various menus of the mobile phone. The display unit 540 may include a display panel 541. Optionally, the display panel 541 may be configured in the form of a liquid crystal display (English full name: Liquid Crystal Display, English abbreviation: LCD), an organic light-emitting diode (English full name: Organic Light-Emitting Diode, English abbreviation: OLED), etc. Further, the touch panel 531 may cover the display panel 541. When the touch panel 531 detects a touch operation on or near it, it is transmitted to the processor 580 to determine the type of touch event. Subsequently, the processor 580 provides corresponding visual output on the display panel 541 according to the type of touch event. Although in Figure 5 In the embodiment, the touch panel 531 and the display panel 541 are used as two independent components to realize the input and output functions of the mobile phone, but in some embodiments, the touch panel 531 and the display panel 541 can be integrated to realize the input and output functions of the mobile phone.
[0143] The mobile phone may also include at least one sensor 550, such as a light sensor, a motion sensor, and other sensors. Specifically, the light sensor may include an ambient light sensor and a proximity sensor, wherein the ambient light sensor may adjust the brightness of the display panel 541 according to the brightness of the ambient light, and the proximity sensor may turn off the display panel 541 and / or the backlight when the mobile phone is moved to the ear. As a type of motion sensor, the accelerometer sensor can detect the magnitude of acceleration in all directions (generally three axes), and can detect the magnitude and direction of gravity when stationary. It can be used for applications that identify the posture of the mobile phone (such as horizontal and vertical screen switching, related games, magnetometer posture calibration), vibration recognition related functions (such as pedometer, tapping), etc.; as for other sensors that the mobile phone can also be configured with, such as gyroscopes, barometers, hygrometers, thermometers, infrared sensors, etc., they will not be described here.
[0144] Audio circuit 560, speaker 561, and microphone 562 provide an audio interface between the user and the phone. Audio circuit 560 converts received audio data into electrical signals and transmits them to speaker 561, which then converts them into sound signals for output. Microphone 562, on the other hand, converts collected sound signals into electrical signals, which are then received by audio circuit 560 and converted into audio data. The audio data is then processed by processor 580 and transmitted via RF circuit 55 to, for example, another phone. Alternatively, the audio data can be output to memory 520 for further processing.
[0145] Wi-Fi is a short-range wireless transmission technology. Mobile phones can help users send and receive emails, browse web pages, and access streaming media through the Wi-Fi module 570. It provides users with wireless broadband Internet access. Figure 5 A Wi-Fi module 570 is shown, but it is understandable that it is not an essential component of the mobile phone and can be omitted as needed without changing the essence of the application.
[0146] Processor 580 is the control center of the mobile phone, connecting all parts of the mobile phone using various interfaces and circuits. By running or executing software programs and / or modules stored in memory 520 and accessing data stored in memory 520, it performs various functions of the mobile phone and processes data, thereby providing overall monitoring of the mobile phone. Optionally, processor 580 may include one or more processing units; preferably, processor 580 may integrate an application processor and a modem processor, wherein the application processor primarily handles the operating system, user interface, and application programs, while the modem processor primarily handles wireless communications. It is understood that the modem processor may not be integrated into processor 580.
[0147] The mobile phone also includes a power supply 590 (such as a battery) for supplying power to various components. The power supply can be logically connected to the processor 580 through a power management system, thereby managing charging, discharging, and power consumption through the power management system.
[0148] Although not shown, the mobile phone may also include a camera, a Bluetooth module, etc., which will not be described in detail here.
[0149] In the embodiment of the present application, the processor 580 included in the mobile phone also has the function of controlling and executing the above Figure 2 Flowchart of the resource adjustment method shown.
[0150] Figure 6 This is a schematic diagram of a server structure provided by an embodiment of the present application. The server 620 may have relatively large differences due to different configurations or performances, and may include one or more central processing units (full name in English: central processing units, abbreviated in English: CPU) 622 (for example, one or more processors) and memory 632, one or more storage media 630 (for example, one or more mass storage devices) for storing application programs 642 or data 644. Among them, the memory 632 and the storage medium 630 can be short-term storage or persistent storage. The program stored in the storage medium 630 may include one or more modules (not shown in the figure), and each module may include a series of instruction operations on the server. Furthermore, the central processing unit 622 can be configured to communicate with the storage medium 630 to execute a series of instruction operations in the storage medium 630 on the server 620.
[0151] The server 620 may also include one or more power supplies 626, one or more wired or wireless network interfaces 650, one or more input and output interfaces 658, and / or one or more operating systems 641, such as Windows Server, Mac OS X, Unix, Linux, FreeBSD, etc.
[0152] The steps performed by the server in the above embodiment can be based on the Figure 6 The structure of the server 620 shown in FIG. Figure 2 The steps shown for the server can be based on the Figure 6 For example, the processor 622 calls the instructions in the memory 632 to perform the following operations:
[0153] The ebpf detection component obtains the current target operation data of the K8S cluster subsystem, and when the target operation data meets the preset conditions, sends the target operation data to the alarm analysis component;
[0154] The alarm analysis component generates a target resource adjustment strategy based on the target operation data, the current number of instances running in the K8S cluster subsystem, and the number of idle resources of the resource adjustment system, and sends the target resource adjustment strategy to the K8S control component;
[0155] The K8S control component adjusts resources of the K8S cluster subsystem according to the target resource adjustment strategy.
[0156] In the above embodiments, the description of each embodiment has its own focus. For parts that are not described in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.
[0157] Those skilled in the art will clearly understand that, for the convenience and brevity of description, the specific working processes of the systems, devices and modules described above can refer to the corresponding processes in the aforementioned method embodiments and will not be repeated here.
[0158] In the several embodiments provided in the embodiments of the present application, it should be understood that the disclosed systems, devices and methods can be implemented in other ways. For example, the device embodiments described above are merely schematic. For example, the division of the modules is only a logical function division. There may be other division methods in actual implementation, such as multiple modules or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be an indirect coupling or communication connection through some interfaces, devices or modules, which can be electrical, mechanical or other forms.
[0159] The modules described as separate components may or may not be physically separate, and the components shown as modules may or may not be physical modules, that is, they may be located in one place or distributed across multiple network modules. Some or all of the modules may be selected to achieve the purpose of the present embodiment according to actual needs.
[0160] In addition, the functional modules in each embodiment of the present application can be integrated into a processing module, or each module can exist physically separately, or two or more modules can be integrated into a module. The above-mentioned integrated modules can be implemented in the form of hardware or in the form of software functional modules. If the integrated modules are implemented in the form of software functional modules and sold or used as independent products, they can be stored in a computer-readable storage medium.
[0161] In the above embodiments, all or part of the embodiments may be implemented by software, hardware, firmware, or any combination thereof. When implemented by software, all or part of the embodiments may be implemented in the form of a computer program product.
[0162] The computer program product includes one or more computer instructions. When the computer program is loaded and executed on a computer, the process or function described in the embodiment of the present application is generated in whole or in part. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable devices. The computer instructions can be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium. For example, the computer instructions can be transmitted from a website, a computer, a server, or a data center by wired (such as coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (such as infrared, wireless, microwave, etc.) mode to another website, a computer, a server, or a data center. The computer-readable storage medium can be any available medium that a computer can store or a data storage device such as a server or a data center that includes one or more available media integrations. The available medium can be a magnetic medium, (such as a floppy disk, a hard disk, a magnetic tape), an optical medium (such as a DVD), or a semiconductor medium (such as a solid-state drive Solid State Disk (SSD)), etc.
[0163] The above is a detailed introduction to the technical solutions provided in the embodiments of the present application. Specific examples are used in the embodiments of the present application to illustrate the principles and implementation methods of the embodiments of the present application. The description of the above embodiments is only used to help understand the methods and core ideas of the embodiments of the present application. At the same time, for those skilled in the art, according to the ideas of the embodiments of the present application, there will be changes in the specific implementation methods and application scopes. In summary, the content of this specification should not be understood as a limitation on the embodiments of the present application.
Claims
1. A resource adjustment method, characterized in that: The method is applied to a resource adjustment system, which includes an ebpf detection component, an alarm analysis component, a K8S control component, and a K8S cluster subsystem. The method includes: The ebpf detection component obtains the current target operation data of the K8S cluster subsystem, and when the target operation data meets the preset conditions, sends the target operation data to the alarm analysis component; The alarm analysis component generates a target resource adjustment strategy based on the target operation data, the current number of instances running in the K8S cluster subsystem, and the number of idle resources of the resource adjustment system, and sends the target resource adjustment strategy to the K8S control component; The K8S control component adjusts resources of the K8S cluster subsystem according to the target resource adjustment strategy; The preset conditions include expansion conditions or reduction conditions; When the target operating data meets the expansion condition; generating a target resource adjustment strategy according to the target operating data, the current number of instances running in the K8S cluster subsystem, and the number of idle resources of the resource adjustment system, including: If the amount of idle resources is greater than a preset first resource threshold, generating a first resource expansion strategy according to the target operation data and a preset first resource expansion rule; If the number of idle resources is less than or equal to the first resource threshold, and the current number of instances is less than a preset first instance threshold, determining a first target number of instances corresponding to the target operating data according to a preset correspondence between operating data and instance numbers, and generating an instance expansion strategy based on the first target number of instances and the current number of instances; If the current number of instances is greater than or equal to the first instance threshold, and the number of idle resources is greater than the preset second resource threshold and less than or equal to the first resource threshold, a second resource expansion strategy is generated according to the target operation data and the preset second resource expansion rule.
2. The method according to claim 1, characterized in that The resource adjustment system further includes an access control component, and the method further includes: If the number of idle resources is less than or equal to the second resource threshold, and the number of current instances is greater than or equal to the first instance threshold, sending an access policy startup instruction to the access control component; The access control component activates a preset access policy in response to the access policy activation instruction.
3. The method according to claim 2, characterized in that After the access control component initiates the preset access policy in response to the access policy activation instruction, the method further includes: The access control component receives an access request from a user terminal, wherein the access request carries a target user identifier of a target user; If the target user identifier is included in the identifier set of the access policy, the access control component allows the user access request to pass; If the target user identifier is not included in the identifier set of the access policy, the access control component rejects the user access request.
4. The method according to claim 1, wherein When the target operating data meets the scaling-down condition; generating a target resource adjustment strategy according to the target operating data, the current number of instances running in the K8S cluster subsystem, and the number of idle resources of the resource adjustment system, including: If the amount of idle resources is less than a preset third resource threshold, generating a first resource scaling-down strategy according to the target operation data and a preset first resource scaling-down rule; If the number of idle resources is greater than or equal to the third resource threshold, and the current number of instances is greater than a preset second instance threshold, determining a second target number of instances corresponding to the target operating data according to a preset correspondence between operating data and instance numbers, and generating an instance scaling-down strategy based on the second target number of instances and the current number of instances; If the number of idle resources is greater than or equal to the third resource threshold and the number of current instances is less than or equal to the second instance threshold, a second resource scaling-in strategy is generated according to the target operation data and a preset second resource scaling-in rule.
5. The method according to any one of claims 1 to 4, characterized in that The target operation data includes at least one of network traffic data, memory occupancy rate, and CPU occupancy rate.
6. A resource adjustment system, characterized in that: The resource adjustment system includes an ebpf detection component, an alarm analysis component, a K8S control component, and a K8S cluster subsystem, wherein: The ebpf detection component is used to obtain the current target operation data of the K8S cluster subsystem, and when the target operation data meets the preset conditions, send the target operation data to the alarm analysis component; The alarm analysis component is used to generate a target resource adjustment strategy based on the target operation data, the current number of instances running in the K8S cluster subsystem, and the number of idle resources of the resource adjustment system, and send the target resource adjustment strategy to the K8S control component; The K8S control component is used to adjust the resources of the K8S cluster subsystem according to the target resource adjustment strategy; The preset conditions include expansion conditions or reduction conditions; When the target operating data meets the expansion condition; when the alarm analysis component executes the step of generating a target resource adjustment strategy based on the target operating data, the current number of instances running in the K8S cluster subsystem, and the number of idle resources in the resource adjustment system, it is specifically used to: If the amount of idle resources is greater than a preset first resource threshold, generating a first resource expansion strategy according to the target operation data and a preset first resource expansion rule; If the number of idle resources is less than or equal to the first resource threshold, and the current number of instances is less than a preset first instance threshold, determining a first target number of instances corresponding to the target operating data according to a preset correspondence between operating data and instance numbers, and generating an instance expansion strategy based on the first target number of instances and the current number of instances; If the current number of instances is greater than or equal to the first instance threshold, and the number of idle resources is greater than the preset second resource threshold and less than or equal to the first resource threshold, a second resource expansion strategy is generated according to the target operation data and the preset second resource expansion rule.
7. A computer device, characterized in that: The computer device includes a memory and a processor, the memory stores a computer program, and the processor implements the method according to any one of claims 1 to 5 when executing the computer program.
8. A computer-readable storage medium, characterized in that The storage medium stores a computer program, wherein the computer program includes program instructions, and when the program instructions are executed by a processor, the method according to any one of claims 1 to 5 can be implemented.
Citation Information
Patent Citations
Capacity expansion and shrinkage control method and device based on Kubernetes cluster and electronic equipment
CN112506444A
Load balancing method and device based on eBPF architecture and used in K8S
CN113568711A