Load balancer management method and device, equipment and storage medium
By creating dedicated load balancer resources for each user, the problem of business interruption caused by shared load balancers was solved, achieving business isolation and improved user experience.
Patent Information
- Application Number
- CN202511194849.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-08-25
- Publication Date
- 2025-11-21
AI Technical Summary
When a load balancer is shared by multiple tenants, modifying the load balancer configuration can cause business processing interruptions and affect business continuity.
By receiving the load balancer pod specifications from the user, an independent Kubernetes resource is created to ensure that the user has a dedicated load balancer and avoids the impact of configuration changes on other users.
This achieves business isolation between users, avoids business interruption issues caused by shared load balancers, and improves user experience.
Smart Images

Figure CN121000730A_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present disclosure relates to the technical field of computer, and particularly relates to a load balancer management method and device, equipment and storage medium. BACKGROUND
[0002] The load balancer can provide load balancing service and can be used to receive and distribute traffic. Currently, one load balancer is shared by multiple tenants.
[0003] Since the load balancing configurations (also referred to as load balancing configuration files, which include the running rules of the load balancer) of all tenants sharing the same load balancer are stored in the directory of the same file system, if a tenant modifies its corresponding load balancing configuration, all load balancing configurations in the directory need to be reloaded to make the modification effective.
[0004] If the load balancer reloads the load balancing configuration during processing of a business request, the business processing will be interrupted, affecting business continuity. SUMMARY
[0005] To solve the above technical problems, the present disclosure provides a load balancer management method, device, equipment and storage medium.
[0006] In a first aspect, the present disclosure provides a load balancer management method, the method comprising:
[0007] receiving specification information of a load balancer pod input by a user and storing the specification information into a database; the specification information at least including quantity, central processing unit (CPU) information and memory information; in response to a creation request of a load balancing instance by the user, generating creation information of the load balancing instance in the database, the creation information including a cloud gateway (XGW) to which the load balancing instance belongs; creating Kubernetes resources corresponding to the load balancing instance according to the specification information and the creation information, the Kubernetes resources including pods conforming to the specification information and configuration information of each pod, the configuration information of each pod including a host to which the pod belongs; in the case that the Kubernetes resources are created successfully, sending the creation information and the configuration information of all pods to the XGW, and sending the configuration information of the pods belonging to the host and the creation information to the host.
[0008] In some optional embodiments, the creation information further includes an identifier and state information of the load balancing instance, and in the process of creating the Kubernetes resources corresponding to the load balancing instance according to the specification information and the creation information, the method further comprises:
[0009] obtaining an identifier of the load balancing instance included in the configuration information of the pod; looking up creation information corresponding to the load balancing instance with the identifier as an index; obtaining state information of the load balancing instance from the creation information; and storing the configuration information of the pod in a case where the state information represents that the Kubernetes resource is being created.
[0010] In some optional embodiments, the obtaining of the identifier of the load balancing instance included in the configuration information of the pod comprises:
[0011] The first thread writes the identifier into the global queue; and the second thread reads the identifier from the global queue.
[0012] In some optional embodiments, the method further comprises:
[0013] In a case where the duration of the creation of the Kubernetes resource exceeds a preset duration, the state information included in the creation information is determined as first state information, and the first state information is used to represent that the creation of the Kubernetes resource fails.
[0014] In some optional embodiments, after the creation of the load balancing instance to be created ends, the method further comprises:
[0015] receiving a deletion request of a user, the deletion request including an identifier of the load balancing instance; looking up the creation information according to the identifier, and determining that the state information included in the creation information is second state information, the second state information being used to represent that the Kubernetes resource corresponding to the load balancing instance is being deleted; deleting the Kubernetes resource corresponding to the load balancing instance; and deleting the creation information and the configuration information of all the pods in the XGW, and the configuration information and the creation information of the pods belonging to the host in the host.
[0016] In some optional embodiments, the creation information includes a graceful termination duration, and the method further comprises:
[0017] taking a moment when the state information included in the creation information is determined as the second state information as a marking moment;
[0018] the deleting of the creation information and the configuration information of all the pods in the XGW, and the configuration information and the creation information of the pods belonging to the host in the host comprises:
[0019] if a time difference between a current moment and the marking moment is greater than or equal to the graceful termination duration, the creation information and the configuration information of all the pods in the XGW, and the configuration information and the creation information of the pods belonging to the host in the host are deleted.
[0020] In some optional embodiments, the method further comprises:
[0021] When the deletion request response fails, the state information included in the creation information is determined as third state information, and the third state information is used to represent that the load balancing instance deletion fails.
[0022] In a second aspect, the disclosure provides a load balancer management device, the device comprising:
[0023] The first storage module is configured to receive specification information of a load balancer pod input by a user and store the specification information into a database; the specification information at least includes a quantity, CPU information, and memory information; the first creation module is configured to generate creation information of a load balancing instance in the database in response to a creation request of the load balancing instance by the user, and the creation information includes a cloud gateway (XGW) to which the load balancing instance belongs; the second creation module is configured to create a Kubernetes resource corresponding to the load balancing instance according to the specification information and the creation information, and the Kubernetes resource includes a pod conforming to the specification information and configuration information of each pod, and the configuration information of each pod includes a host to which the pod belongs; and the sending module is configured to send the creation information and the configuration information of all the pods to the XGW and send the configuration information of the pods belonging to the host and the creation information to the host in a case where the Kubernetes resource is successfully created.
[0024] In a third aspect, the disclosure provides a computer device, comprising:
[0025] The memory and the processor are communicatively connected to each other, the memory stores computer instructions, and the processor executes the computer instructions to perform the load balancer management method of the first aspect and any one of the embodiments.
[0026] In a fourth aspect, the disclosure provides a computer readable storage medium, and the computer readable storage medium stores computer instructions, and the computer instructions are used to make a computer execute the load balancer management method of the first aspect and any one of the embodiments.
[0027] Compared with the prior art, the technical scheme provided by the embodiments of the disclosure has the following advantages:
[0028] The load balancer management method provided by the embodiments creates a Kubernetes resource corresponding to a load balancing instance according to specification information of a load balancer pod input by a user and a creation request of the load balancing instance by the user. The present solution creates an independent pod for the user as a load balancer exclusively used by the user through the above-mentioned manner, ensures that the services of the users are isolated from each other, and ensures that the modification of the load balancing configuration by the user does not affect other users, thereby solving the service interruption problem caused by the sharing of the load balancer and improving the user experience. Attached Figure Description
[0029] The accompanying drawings, which are incorporated in and form a part of this specification, illustrate embodiments consistent with this disclosure and, together with the description, serve to explain the principles of this disclosure.
[0030] To more clearly illustrate the technical solutions in the embodiments of this disclosure or the prior art, the accompanying drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, those skilled in the art can obtain other drawings based on these drawings without creative effort.
[0031] Figure 1 A flowchart illustrating a load balancer management method provided in an embodiment of this disclosure;
[0032] Figure 2 A structural connection diagram of a management device for a load balancer provided in an embodiment of this disclosure;
[0033] Figure 3 This is a structural connection diagram of a computer device provided in an embodiment of the present disclosure. Detailed Implementation
[0034] To better understand the above-mentioned objectives, features, and advantages of this disclosure, the solutions disclosed herein will be further described below. It should be noted that, unless otherwise specified, the embodiments and features described herein can be combined with each other.
[0035] Numerous specific details are set forth in the following description to provide a thorough understanding of this disclosure, but this disclosure may also be implemented in other ways different from those described herein; obviously, the embodiments in the specification are only a part of the embodiments of this disclosure, and not all of them. All other embodiments obtained by those skilled in the art based on the embodiments of this disclosure without inventive effort are within the scope of protection of this disclosure.
[0036] It should be noted that, in this document, relational terms such as "first" and "second", and the like can be used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Moreover, the terms "comprises", "comprising", or any other variations thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but can include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element preceded by "comprises... " does not, without more constraints, foreclose the existence of additional identical elements in the process, method, article, or apparatus that comprises the element.
[0037] Before the embodiments of the present disclosure are described in detail, the technical terms involved in the embodiments of the present disclosure are described so as to have a clearer understanding of the embodiments of the present disclosure.
[0038] pod: is the smallest unit created or deployed by Kubernetes (k8s for short), each pod can be regarded as an independent load balancer (tengine), which forwards user requests. A load balancing instance can create multiple load balancer pods.
[0039] pool_instance: is a persistent entity that records the relevant information of the load balancer pod. All load balancer pods recorded in pool_instance must be in an available state. The state of the load balancer pod is crucial for system monitoring and troubleshooting, and the state of the load balancer pod provides real-time health status feedback, enabling administrators to quickly respond and handle any potential problems.
[0040] lb-task-agent: is an asynchronous service component for listening to events and processing tasks.
[0041] According to the embodiments of the present disclosure, a load balancer management method embodiment is provided. It should be noted that the steps shown in the flowchart of the accompanying drawings can be executed in a computer system such as a set of computer executable instructions, and although a logical order is shown in the flowchart, in some cases, the steps shown or described herein can be executed in an order different from that shown.
[0042] In this embodiment, a load balancer management method is provided, which is applied to a resource management service component of a cloud platform, Figure 1 The flowchart of the load balancer management method according to the embodiments of the present disclosure is shown in FIG. 1, which includes the following steps: Figure 1
[0043] S101, receiving specification information of a load balancer pod input by a user, and storing the specification information into a database.
[0044] The specification information of the load balancer pod corresponds to the user demand. The specification information at least includes a number, central processing unit (CPU) information and memory information. The number is the number of the pods; the CPU information and the memory information are the CPU information and the memory information corresponding to each pod.
[0045] For example, the user can specify the specification information of the pod corresponding to the load balancing instance to be created by selecting or directly inputting, etc.
[0046] S102, in response to a user request for creating a load balancing instance, generating creation information of the load balancing instance in the database.
[0047] The creation information includes a cloud gateway (XGW, four-layer cloud gateway) to which the load balancing instance belongs. Optionally, it also includes a load balancing instance identifier, an identifier of a virtual private cloud to which the load balancing instance belongs, a user identifier, an image identifier, an image url, an identifier of a Kubernetes cluster corresponding to the load balancing instance, a graceful termination time and state information of the load balancing instance, etc.
[0048] The state information of the load balancing instance changes with the creation state of the Kubernetes resource corresponding to the load balancing instance. Here, since the Kubernetes resource has not started to be created, the state information of the load balancing instance is in a creating state.
[0049] In addition, the state information also includes an active state, a deleting state and an error state, etc. The error state can be a state displayed when an exception occurs in the creation process of the load balancing instance. The exception includes but is not limited to a Kubernetes resource creation timeout, a Kubernetes resource deletion failure, etc.
[0050] It should be noted here that the load balancing instance is used to process the traffic forwarded by the cloud gateway XGW. The load balancing instance implements the load balancing function through the Kubernetes cluster corresponding thereto. The pod corresponding to the load balancing instance is deployed in a host subordinate to the Kubernetes cluster.
[0051] Optionally, in response to a user call to an application programming interface for creating a load balancing instance, a resource management service component of a cloud platform automatically generates creation information of the load balancing instance, which is also referred to as pool information below.
[0052] S103, create the Kubernetes resource corresponding to the load balancing instance according to the specification information and the creation information.
[0053] The Kubernetes resource includes pods conforming to the specification information and configuration information of each pod, and the configuration information of each pod includes a host to which the pod belongs. Optionally, the configuration information of each pod further includes a pod identifier (such as a name), resource information (such as CPU information and memory information) of the pod, an identifier of the load balancing instance to which the pod belongs, an image identifier corresponding to the pod, an image url corresponding to the pod, and a running state of the pod. It should be noted that the resource information of the pod is the resource information in the specification information of the pod, that is, the CPU information and the memory information. The configuration information of the pod is generated in a pod creation process.
[0054] Optionally, the Kubernetes resource further includes a deployment and an hpa. The deployment is a controller for managing the life cycle of the pod, which ensures that a specified number of pods are always running in the cluster by defining the desired state of the pod (such as the number of replicas, images, etc.). When a pod fails or is deleted, the deployment automatically creates a new pod to replace the failed or deleted pod. The hpa (HorizontalPod Autoscaler) is a controller that automatically adjusts the number of pod replicas according to resource usage (such as CPU, memory, etc.). When the Kubernetes resource includes the deployment and the hpa, the pod resource can be flexibly expanded and reduced, so as to cope with different traffic demands.
[0055] Specifically, after generating the creation information, the resource management service component of the cloud platform automatically calls a resource creation interface provided by the Kubernetes platform, and creates the Kubernetes resource corresponding to the load balancing instance on the Kubernetes platform according to the specification information of the pod and the creation information of the load balancing instance.
[0056] S104, in the case that the Kubernetes resource is successfully created, the creation information and the configuration information of all pods are sent to the XGW, and the configuration information of the pod belonging to the host and the creation information are sent to the host.
[0057] Specifically, in the case that the Kubernetes resource is successfully created, the creation information of the load balancing instance and the configuration information of all the pods under the load balancing instance are sent to the four-layer cloud gateway (i.e., XGW). At the same time, the creation information of the load balancing instance and the configuration information of the pods belonging to the host in the Kubernetes cluster corresponding to the load balancing instance are sent to the host, so that the XGW and the hosts complete the configuration process according to the received information.
[0058] Optionally, after obtaining the configuration information of the pods, the pod configuration information can be written into the pool_instance table in the database. The pool_instance table is used to store the configuration information of all the pods corresponding to the load balancing instance. In the case that the Kubernetes resource is successfully created, the pool information and the pool_instance table are sent to the XGW. For each host to which a pod corresponding to the load balancing instance belongs, the host is sent the pool information and the configuration information of the pod corresponding to the host in the pool_instance table.
[0059] Further, the judgment manner of whether the Kubernetes resource is successfully created can be that whether the number of the configuration information of the pods in the pool_instance table is consistent with the number in the pod specification information. If not, it indicates that the creation is not successful. If yes, it indicates that the creation is successful.
[0060] Optionally, in the case that the Kubernetes resource is successfully created and the XGW and the hosts all complete the configuration, the creation information of the load balancing instance is modified from the creating state to the active state.
[0061] The management method of the load balancer provided by the embodiments of the present disclosure creates the Kubernetes resource corresponding to the load balancing instance according to the specification information of the load balancer pod input by the user and the creation request of the load balancing instance by the user. The present scheme creates an independent pod for the user as a load balancer exclusively used by the user through the above-mentioned manner, ensures the mutual isolation of the services between users, and makes the modification of the load balancing configuration by the user not affect other users, thereby solving the service interruption problem caused by the sharing of the load balancer and improving the user experience.
[0062] In some optional embodiments, in the process of creating the Kubernetes resource corresponding to the load balancing instance according to the specification information and the creation information, a storage process of the pod configuration information is added. In this embodiment, the method further comprises: obtaining the identification of the load balancing instance included in the configuration information of the pod; finding the creation information corresponding to the load balancing instance with the identification as the index; obtaining the state information of the load balancing instance from the creation information; and storing the configuration information of the pod in the case that the state information represents that the Kubernetes resource is being created.
[0063] Specifically, in the process of creating the Kubernetes resource corresponding to the load balancing instance according to the specification information and the creation information, a process with master permission in the lb-task-agent component is enabled to listen to the creation process of the Kubernetes resource. The process with master permission includes a main thread.
[0064] After obtaining the configuration information of the pod, the main thread obtains the identification of the load balancing instance to which the pod belongs from the configuration information of the pod. The creation information corresponding to the load balancing instance is found with the identification as the index. The state information of the load balancing instance is obtained from the creation information. In the case that the state information represents that the Kubernetes resource is being created (i.e., the creation information is in the creating state), the configuration information of the pod is stored in the pool_instance table corresponding to the load balancing instance.
[0065] Optionally, in some examples, the process of obtaining the identification of the load balancing instance included in the configuration information of the pod is optimized, and the optimization process comprises: the first thread writes the identification into a global queue; and the second thread reads the identification from the global queue.
[0066] Specifically, the process with master permission includes a first thread (process_watch_pod) and a second thread (process_changed_pool). The first thread process_watch_pod listens to the pod event. When the first thread process_watch_pod listens to the successful creation of the pod, the configuration information of the pod generated in the creation process is obtained. The identification of the load balancing instance to which the pod belongs is obtained from the configuration information of the pod, and the identification is written into a global queue. The second thread process_changed_pool reads the identification in the global queue in turn, and executes the subsequent step of storing the configuration information of the pod with the identification as the index.
[0067] The embodiment realizes the storage of the configuration information of the pod through the cooperation of two threads, decouples the listening action and the storage action, ensures the real-time performance of the data, and improves the response speed. In addition, the embodiment introduces the global queue, which is equivalent to adding a buffer space, avoids the blocking problem in the high concurrency scenario, and improves the storage efficiency of the pod information.
[0068] Further, in the creation process of the Kubernetes resource, a processing process in the case of a Kubernetes resource creation timeout is added. The method further includes: in the case that the duration of creating the Kubernetes resource exceeds a preset duration, determining that the state information included in the creation information is first state information.
[0069] The first state information is used to represent a Kubernetes resource creation failure.
[0070] For example, the first state information is error.
[0071] Specifically, the process with the master permission in the lb-task-agent component listens to the creation process of the Kubernetes resource. In the case of a load balancing instance corresponding Kubernetes resource creation timeout, the state information in the creation information of the load balancing instance is modified to the first state information representing the Kubernetes resource creation failure, such as error. It should be noted that the creation operation timeout of the Kubernetes resource can be a certain pod creation timeout or a total duration timeout, and the embodiment does not limit this.
[0072] Optionally, after modifying the state information in the creation information to the first state information, the notification information of the resource creation failure can also be fed back to the console to remind the user to submit the creation request again.
[0073] In the case of a creation operation timeout, the embodiment modifies the state of the load balancing instance to be created to error to avoid executing the subsequent configuration delivery operation.
[0074] In some optional embodiments, the user can delete the load balancing instance corresponding to the user. Therefore, after ending the creation of the load balancing instance to be created, the method further includes: receiving a deletion request of the user, the deletion request including an identifier of the load balancing instance; finding the creation information according to the identifier, and determining that the state information included in the creation information is second state information; deleting the Kubernetes resource corresponding to the load balancing instance; and deleting the creation information and the configuration information of all pods in the XGW, and the configuration information and the creation information of the pods belonging to the host in the host.
[0075] The second state information is used to represent that the Kubernetes resource corresponding to the load balancing instance is being deleted.
[0076] The second state information is deleting, for example.
[0077] Further, in order to avoid that some services being executed are forcibly terminated after receiving the deletion request, the management method of the load balancer is optimized, and the method further includes: taking a time point when the state information included in the creation information is determined as the second state information as a marking time point. On this basis, the creation information and the configuration information of all pods in the XGW and the configuration information and the creation information of the pods belonging to the host in the host are deleted, including: if a time difference between the current time and the marking time point is greater than or equal to the graceful termination duration, the creation information and the configuration information of all pods in the XGW and the configuration information and the creation information of the pods belonging to the host in the host are deleted.
[0078] The creation information includes the graceful termination duration.
[0079] Specifically, when the state information in the creation information corresponding to the load balancing instance is modified to the second state information, such as deleting, the time point when the state information is modified is taken as the marking time point. Then, the time difference between the current time and the marking time point is calculated. When the time difference is less than the graceful termination duration, the deletion operation is not performed. When the time difference is greater than or equal to the graceful termination duration, the creation information and the configuration information of all pods in the XGW and the configuration information and the creation information of the pods belonging to the host in the host are deleted.
[0080] The embodiment sets the graceful termination duration, so that the configuration information of the load balancing instance on the XGW and each host is delayed to be deleted. This way can avoid that the services being executed are forcibly terminated, and is also beneficial to data recovery and rollback, and improves the overall security and fault tolerance.
[0081] Further, if the deletion request response fails, the method further includes: when the deletion request response fails, determining that the state information included in the creation information is third state information.
[0082] The third state information is used to represent that the deletion of the load balancing instance fails.
[0083] The third state information is error, for example.
[0084] Specifically, the deletion request response failure includes but is not limited to the failure of the deletion operation on the Kubernetes resource, the deletion operation on the creation information and the configuration information of all pods in the XGW, or the deletion operation on the creation information and the configuration information of the corresponding pods in the host.
[0085] Optionally, when the state information in the creation information is modified to the third state information, a notification information of the deletion response failure can be sent to the client, so that the user performs the next operation according to the notification information.
[0086] In the embodiment, a management device of the load balancer is also provided, which is used to implement the above-mentioned embodiments and preferred embodiments, and details are not repeated. As used below, the term "module" can be a combination of software and / or hardware that implements a predetermined function. Although the device described in the following embodiments is preferably implemented in software, implementation of hardware, or a combination of software and hardware, is also possible and contemplated.
[0087] The embodiment provides a management device of the load balancer, as shown in Figure 2 The device comprises:
[0088] The first storage module 201 is configured to receive the specification information of the load balancer pod input by the user, and store the specification information into the database; the specification information at least includes the number, CPU information and memory information.
[0089] The first creation module 202 is configured to generate the creation information of the load balancing instance in the database in response to the creation request of the load balancing instance by the user, and the creation information includes the cloud gateway XGW to which the load balancing instance belongs.
[0090] The second creation module 203 is configured to create the Kubernetes resource corresponding to the load balancing instance according to the specification information and the creation information, and the Kubernetes resource includes the pod conforming to the specification information and the configuration information of each pod, and the configuration information of each pod includes the host to which the pod belongs.
[0091] The sending module 204 is configured to send the creation information and the configuration information of all pods to the XGW and send the configuration information and the creation information of the pod belonging to the host to the host in the case that the Kubernetes resource is successfully created.
[0092] In some optional embodiments, the creation information further includes the identification and the state information of the load balancing instance, and the device further comprises:
[0093] In the process of creating the Kubernetes resource corresponding to the load balancing instance according to the specification information and the creation information, the first obtaining module is configured to obtain an identifier of the load balancing instance included in the configuration information of the pod; the first searching module is configured to search the creation information corresponding to the load balancing instance with the identifier as an index; the second obtaining module is configured to obtain state information of the load balancing instance from the creation information; and the second storage module is configured to store the configuration information of the pod in a case where the state information represents that the Kubernetes resource is being created.
[0094] In some optional embodiments, the first obtaining module comprises:
[0095] The writing submodule is configured to write the identifier into the global queue by the first thread; and the reading submodule is configured to read the identifier from the global queue by the second thread.
[0096] In some optional embodiments, the apparatus further comprises:
[0097] The first determining module is configured to determine that the state information included in the creation information is first state information in a case where a duration of creating the Kubernetes resource exceeds a preset duration, the first state information being used to represent that the creation of the Kubernetes resource fails.
[0098] In some optional embodiments, the apparatus further comprises:
[0099] The receiving module is configured to receive a deletion request of a user after ending the creation of the load balancing instance to be created, the deletion request including the identifier of the load balancing instance; the second searching module is configured to search the creation information according to the identifier and determine that the state information included in the creation information is second state information, the second state information being used to represent that the Kubernetes resource corresponding to the load balancing instance is being deleted; the first deleting module is configured to delete the Kubernetes resource corresponding to the load balancing instance; and the second deleting module is configured to delete the creation information and the configuration information of all the pods in the XGW and the configuration information of the pod belonging to the host and the creation information in the host.
[0100] In some optional embodiments, the creation information includes a graceful termination duration, and the apparatus further comprises:
[0101] The second determining module is configured to take a moment when it is determined that the state information included in the creation information is the second state information as a marking moment.
[0102] The second deleting module comprises:
[0103] The delete submodule is used to delete the creation information and configuration information of all pods in XGW, as well as the configuration information and creation information of pods belonging to the host machine in the host machine, if the time difference between the current time and the marked time is greater than or equal to the graceful termination duration.
[0104] In some alternative embodiments, the apparatus further includes:
[0105] The third determination module is used to determine the status information included in the creation information as the third status information when the deletion request response fails. The third status information is used to characterize the failure of the load balancer instance deletion.
[0106] Further functional descriptions of the above modules and units are the same as those in the corresponding embodiments described above, and will not be repeated here.
[0107] In this embodiment, the management device of the load balancer is presented in the form of a functional unit. Here, a unit refers to an ASIC (Application Specific Integrated Circuit) circuit, a processor and memory that execute one or more software or fixed programs, and / or other devices that can provide the above functions.
[0108] This disclosure also provides a computer device having the above-described features. Figure 2 The load balancer management device shown.
[0109] Please see Figure 3 , Figure 3 This is a schematic diagram of the structure of a computer device provided in an optional embodiment of this disclosure, such as... Figure 3 As shown, the computer device includes one or more processors 301, memory 302, and interfaces for connecting the components, including high-speed interfaces and low-speed interfaces. The components communicate with each other via different buses and can be mounted on a common motherboard or otherwise installed as needed. The processors can process instructions executed within the computer device, including instructions stored in or on memory to display graphical information of a GUI on external input / output devices (such as display devices coupled to the interfaces). In some alternative implementations, multiple processors and / or multiple buses can be used with multiple memories and multiple memory modules, if desired. Similarly, multiple computer devices can be connected, each providing some of the necessary operations (e.g., as a server array, a group of blade servers, or a multiprocessor system). Figure 3 Take processor 301 as an example.
[0110] The processor 301 can be a central processing unit, a network processing unit, or a combination thereof. The processor 301 can further include a hardware chip. The hardware chip can be an application specific integrated circuit, a programmable logic device, or a combination thereof. The programmable logic device can be a complex programmable logic device, a field programmable logic device, a general array logic, or any combination thereof.
[0111] The memory 302 stores instructions executable by the at least one processor 301 to cause the at least one processor 301 to perform the methods illustrated in the above embodiments.
[0112] The memory 302 can include a program storage area and a data storage area. The program storage area can store an operating system, application programs required by at least one function, and the like. The data storage area can store data created according to the use of the computer device, and the like. In addition, the memory 302 can include a high-speed random access memory, and can further include a non-transitory memory such as at least one magnetic disk storage device, a flash memory device, or other non-transitory solid state memory device. In some optional embodiments, the memory 302 can optionally include a memory disposed remotely from the processor 301, and these remote memories can be connected to the computer device through a network. Examples of the network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and a combination thereof.
[0113] The memory 302 can include a volatile memory such as a random access memory, and can also include a non-volatile memory such as a flash memory, a hard disk, or a solid state disk. The memory 302 can further include a combination of the above-mentioned kinds of memories.
[0114] The computer device further includes a communication interface 303 for communication of the computer device with other devices or communication networks.
[0115] The embodiments of the present disclosure further provide a computer readable storage medium, and the method according to the embodiments of the present disclosure can be implemented in hardware, firmware, or recorded in a storage medium, or be implemented by computer code originally stored in a remote storage medium or non-transitory machine readable storage medium and downloaded to a local storage medium, so that the method described herein can be processed by such software on a storage medium using a general purpose computer, a special purpose processor, or programmable or special hardware. Among them, the storage medium can be a magnetic disk, an optical disk, a read-only memory, a random access memory, a flash memory, a hard disk or a solid state disk, etc.; further, the storage medium can also include a combination of the above types of memories. It can be understood that the computer, processor, microprocessor controller or programmable hardware includes a storage component that can store or receive software or computer code, when the software or computer code is accessed and executed by the computer, processor or hardware, the method shown in the above embodiments is implemented.
[0116] In addition to the above computer device and computer readable storage medium, the embodiments of the present application can also be a computer program product, which includes computer program instructions, which, when executed by a processor, cause the processor to perform the steps of the sound source positioning method provided by any embodiment of the present application.
[0117] The computer program product can be written in any combination of one or more programming languages to perform the operations of the embodiments of the present application, including object-oriented programming languages, such as Java, C++, etc., and conventional procedural programming languages, such as "C" language or similar programming languages. The program code can be executed entirely on a user computing device, partially on a user device, as an independent software package, partially on a user computing device and partially on a remote computing device, or entirely on a remote computing device or server.
[0118] The above is only a specific embodiment of the present disclosure, which enables those skilled in the art to understand or implement the present disclosure. Various modifications to these embodiments will be apparent to those skilled in the art, and the general principles defined herein can be implemented in other embodiments without departing from the spirit or scope of the present disclosure. Therefore, the present disclosure will not be limited to these embodiments described herein, but will conform to the widest scope consistent with the principles and novel features disclosed herein.
Claims
1. A method of managing a load balancer, the method comprising: The method comprises: receiving user inputted specification information of a load balancer pod, and storing the specification information into a database; the specification information at least comprises quantity, central processing unit (CPU) information and memory information; generating creation information of the load balancing instance in the database in response to a creation request of the load balancing instance by the user, the creation information comprising a cloud gateway (XGW) to which the load balancing instance belongs; creating a Kubernetes resource corresponding to the load balancing instance according to the specification information and the creation information, the Kubernetes resource comprising pods conforming to the specification information and configuration information of each pod, the configuration information of each pod comprising a host to which the pod belongs; in a case where the Kubernetes resource is successfully created, sending the creation information and configuration information of all pods to the XGW, and sending configuration information of pods belonging to the host and the creation information to the host.
2. The method of claim 1, wherein, The creation information further comprises an identifier and state information of the load balancing instance, and in the process of creating the Kubernetes resource corresponding to the load balancing instance according to the specification information and the creation information, the method further comprises: obtaining the identifier of the load balancing instance included in the configuration information of the pod; finding the creation information corresponding to the load balancing instance with the identifier as an index; obtaining the state information of the load balancing instance from the creation information; in a case where the state information represents that the Kubernetes resource is being created, storing the configuration information of the pod.
3. The method according to claim 1 or 2, characterized in that, The obtaining of the identifier of the load balancing instance included in the configuration information of the pod comprises: a first thread writes the identifier into a global queue; a second thread reads the identifier from the global queue.
4. The method of claim 1, wherein, The method further comprises: in a case where a duration of creating the Kubernetes resource exceeds a preset duration, determining that the state information included in the creation information is first state information, the first state information being used to represent that the Kubernetes resource fails to be created.
5. The method according to claim 1 or 2, characterized in that, The method further comprises: receiving a deletion request of the user, the deletion request comprising the identifier of the load balancing instance; finding the creation information according to the identifier, and determining that the state information included in the creation information is second state information, the second state information being used to represent that the Kubernetes resource corresponding to the load balancing instance is being deleted; deleting the Kubernetes resource corresponding to the load balancing instance; deleting the creation information and the configuration information of all pods in the XGW, and deleting the configuration information of the pods belonging to the host and the creation information in the host.
6. The method of claim 5, wherein, The creation information comprises a graceful termination duration, and the method further comprises: taking a moment when it is determined that the state information included in the creation information is the second state information as a marking moment. The deleting the creation information and the configuration information of all the pods in the XGW, and the configuration information of the pod belonging to the host and the creation information in the host, comprises: If a time difference between a current time and the marking time is greater than or equal to the graceful termination duration, the creation information and the configuration information of all the pods in the XGW, and the configuration information of the pod belonging to the host and the creation information in the host are deleted.
7. The method of claim 5, wherein, The method further comprises: When the deletion request response fails, determining that state information included in the creation information is third state information, and the third state information is used to represent deletion failure of the load balancing instance.
8. A management apparatus of a load balancer, characterized by, The apparatus comprises: A first storage module configured to receive specification information of a load balancing pod input by a user, and store the specification information into a database; the specification information at least comprises a number, central processing unit (CPU) information and memory information; A first creation module configured to, in response to a creation request of a load balancing instance by the user, generate creation information of the load balancing instance in the database, the creation information comprising a cloud gateway (XGW) to which the load balancing instance belongs; A second creation module configured to, according to the specification information and the creation information, create a Kubernetes resource corresponding to the load balancing instance, the Kubernetes resource comprising a pod conforming to the specification information and configuration information of each pod, the configuration information of each pod comprising a host to which the pod belongs; A sending module configured to, in a case where the Kubernetes resource is successfully created, send the creation information and the configuration information of all the pods to the XGW, and send the configuration information of the pod belonging to the host and the creation information to the host.
9. A computer device, comprising: comprise: A memory and a processor, which are in communication connection with each other, and the memory stores computer instructions; the processor executes the computer instructions, thereby performing the load balancer management method in any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that, The computer readable storage medium stores computer instructions, and the computer instructions are used to make a computer execute the load balancer management method in any one of claims 1 to 7.
Citation Information
Patent Citations
Information processing method and device and storage medium
CN113268308A
Container load balancing method and device, equipment and storage medium
CN114374696A
Load balancing service deployment method, system, device and equipment and storage medium
CN116781700A
Parameter verification method of Kubernetes object, server and terminal
CN117112124A
Method and device for elegantly closing Pod based on Kubernetes, storage medium and program product
CN119396474A