CN111367662A - Load balancing method, device and system - Google Patents

Load balancing method, device and system Download PDF

Info

Publication number
CN111367662A
CN111367662A CN202010119796.8A CN202010119796A CN111367662A CN 111367662 A CN111367662 A CN 111367662A CN 202010119796 A CN202010119796 A CN 202010119796A CN 111367662 A CN111367662 A CN 111367662A
Authority
CN
China
Prior art keywords
target service
service
nginx
access data
configuration file
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN202010119796.8A
Other languages
Chinese (zh)
Other versions
CN111367662B (en
Inventor
陈晓宇
尚伏鹏
张健伟
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Puxin Hengye Technology Development Beijing Co ltd
Original Assignee
Puxin Hengye Technology Development Beijing Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Puxin Hengye Technology Development Beijing Co ltd filed Critical Puxin Hengye Technology Development Beijing Co ltd
Priority to CN202010119796.8A priority Critical patent/CN111367662B/en
Publication of CN111367662A publication Critical patent/CN111367662A/en
Application granted granted Critical
Publication of CN111367662B publication Critical patent/CN111367662B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/50Allocation of resources, e.g. of the central processing unit [CPU]
    • G06F9/5005Allocation of resources, e.g. of the central processing unit [CPU] to service a request
    • G06F9/5027Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resource being a machine, e.g. CPUs, Servers, Terminals
    • G06F9/505Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resource being a machine, e.g. CPUs, Servers, Terminals considering the load
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/50Allocation of resources, e.g. of the central processing unit [CPU]
    • G06F9/5083Techniques for rebalancing the load in a distributed system
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D30/00Reducing energy consumption in communication networks
    • Y02D30/50Reducing energy consumption in communication networks in wire-line communication networks, e.g. low power modes or reduced link rate

Abstract

The invention provides a load balancing method, a device and a system, wherein the method comprises the following steps: the Kubernetes cluster sends the configuration information of the service to the Nginx manager, and the Nginx manager creates a configuration file for the target service in the Kubernetes cluster according to the configuration information of the service; determining an access data stream corresponding to the target service according to a preset load balancing strategy; sending a configuration file corresponding to the target service and an access data stream to an Nginx server; and the Nginx server forwards the access data stream to the target service according to the configuration file. The Nginx manager can determine the access data flow corresponding to the target service according to a preset load balancing strategy, and realize uniform balanced distribution of the access data flow corresponding to the target service in the Kubernets cluster, so that the load balancing of the service in the Kubernets cluster is realized.

Description

Load balancing method, device and system
Technical Field
The present invention relates to the field of information processing technologies, and in particular, to a load balancing method, apparatus, and system.
Background
Kubernets is an open-source container arranging and scheduling system, and is composed of a plurality of Kubernets clusters, each Kubernets cluster comprises at least one service, each service is composed of at least one pod, and each pod runs a process of the corresponding service. Because mutual access can be performed between the Kubernets cluster and the Kubernets cluster inside the Kubernets system, a host outside the Kubernets system can also access the Kubernets cluster inside the Kubernets system, and therefore, how to realize load balancing of services in the Kubernets cluster becomes a technical problem to be solved at present.
Disclosure of Invention
In view of this, the present invention provides a load balancing method, device and system to realize load balancing of services in a Kubernetes cluster.
In order to achieve the purpose, the invention provides the following technical scheme:
a load balancing method applied to a Nginx manager, the method comprising:
receiving configuration information of the service from the Kubernetes cluster;
according to the configuration information of the service, a configuration file is created for the target service in the Kubernetes cluster;
determining an access data stream corresponding to the target service according to a preset load balancing strategy;
and sending the configuration file corresponding to the target service and the access data stream to a Nginx server, so that the Nginx server forwards the access data stream to the target service in the Kubernetes cluster according to the configuration file.
Preferably, the creating a configuration file for the target service in the kubernets cluster according to the configuration information of the service includes:
determining a target service needing to create a configuration file in an Nginx manager according to the configuration information of the service;
and creating a configuration file for the target service according to the configuration information of the target service.
Preferably, the method further comprises:
receiving updated configuration information of a target service from the Kubernetes cluster;
and updating the configuration file corresponding to the target service by using the updated configuration information of the target service.
Preferably, the method further comprises:
and sending traffic monitoring indication information to a Nginx server, so that the Nginx server monitors the traffic of the access data stream sent to the Kubernetes cluster.
Preferably, the access data stream corresponding to the target service includes:
access data flow between kubernets clusters in a kubernets system and/or access data flow outside the kubernets system.
A load balancing apparatus applied to a Nginx manager, the apparatus comprising:
a configuration information receiving unit, configured to receive configuration information of a service from a kubernets cluster;
a configuration file creating unit, configured to create a configuration file for a target service in the Kubernetes cluster according to the configuration information of the service;
the access data flow determining unit is used for determining the access data flow corresponding to the target service according to a preset load balancing strategy;
and the sending unit is used for sending the configuration file corresponding to the target service and the access data stream to an Nginx server, so that the Nginx server forwards the access data stream to the target service in the Kubernetes cluster according to the configuration file.
Preferably, the configuration file creating unit includes:
the target service determining unit is used for determining a target service needing to create a configuration file in the Nginx manager according to the configuration information of the service;
and the configuration file creating subunit is used for creating a configuration file for the target service according to the configuration information of the target service.
Preferably, the apparatus further comprises:
an update configuration information receiving unit, configured to receive update configuration information of a target service from the kubernets cluster;
and the updating unit is used for updating the configuration file corresponding to the target service by using the updated configuration information of the target service.
A load balancing system, the system comprising at least: a Nginx manager, a Nginx server, and a Kubernetes cluster;
the Kubernetes cluster is used for sending configuration information of the service to the Nginx manager;
the Nginx manager is used for creating a configuration file for the target service in the Kubernetes cluster according to the configuration information of the service; determining an access data stream corresponding to the target service according to a preset load balancing strategy; sending a configuration file corresponding to the target service and an access data stream to an Nginx server;
and the Nginx server is used for forwarding the access data stream to a target service in a Kubernetes cluster according to the configuration file.
Preferably, the system further comprises:
the Kubernets cluster manager is used for creating services in the Kubernets cluster and configuring configuration information of the services.
As can be seen from the above technical solutions, compared with the prior art, the present invention provides a load balancing method, apparatus and system, where the method includes: the Kubernetes cluster sends configuration information of the service to an Nginx manager, and the Nginx manager creates a configuration file for a target service in the Kubernetes cluster according to the configuration information of the service; determining an access data stream corresponding to the target service according to a preset load balancing strategy; sending a configuration file corresponding to the target service and an access data stream to an Nginx server; and the Nginx server forwards the access data stream to a target service according to the configuration file. The Nginx manager can determine the access data flow corresponding to the target service according to a preset load balancing strategy, and realize uniform balanced distribution of the access data flow corresponding to the target service in the Kubernets cluster, so that the load balancing of the service in the Kubernets cluster is realized.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below, it is obvious that the drawings in the following description are only embodiments of the present invention, and for those skilled in the art, other drawings can be obtained according to the provided drawings without creative efforts.
Fig. 1 is a schematic structural diagram of a load balancing system according to an embodiment of the present invention;
fig. 2 is a signaling flowchart of a load balancing method according to an embodiment of the present invention;
fig. 3 is a schematic structural diagram of a load balancing system according to an embodiment of the present invention;
fig. 4 is a flowchart of a load balancing method according to an embodiment of the present invention;
fig. 5 is another flowchart of a load balancing method according to an embodiment of the present invention;
fig. 6 is a block diagram of a load balancing apparatus according to an embodiment of the present invention.
Detailed Description
The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
Kubernets is an open-source container arranging and scheduling system, and is composed of a plurality of Kubernets clusters, each Kubernets cluster comprises at least one service, each service is composed of at least one pod, and each pod runs a process of the corresponding service. Because mutual access can be performed between the Kubernets cluster and the Kubernets cluster inside the Kubernets system, and a host outside the Kubernets system can also access the Kubernets cluster inside the Kubernets system, based on the above, how to realize service load balance inside the Kubernets cluster and service load balance between the Kubernets cluster and the Kubernets cluster become technical problems to be solved at present.
The invention provides a load balancing method, a device and a system, wherein the method comprises the following steps: the Kubernetes cluster sends configuration information of the service to an Nginx manager, and the Nginx manager creates a configuration file for a target service in the Kubernetes cluster according to the configuration information of the service; determining an access data stream corresponding to the target service according to a preset load balancing strategy; sending a configuration file corresponding to the target service and an access data stream to an Nginx server; and the Nginx server forwards the access data stream to a target service in the Kubernetes cluster according to the configuration file. The Nginx manager can determine the access data flow corresponding to the target service according to a preset load balancing strategy, and realize uniform balanced distribution of the access data flow corresponding to the target service in the Kubernets cluster, so that the load balancing of the service in the Kubernets cluster is realized.
Fig. 1 is a schematic structural diagram of a load balancing system according to an embodiment of the present invention, where a load balancing method according to an embodiment of the present invention may be implemented by the load balancing system; referring to fig. 1, the load balancing system may include: a Nginx manager 10, a Nginx server 11, and a Kubernets cluster 12.
Based on the load balancing system shown in fig. 1, fig. 2 shows a signaling flow chart of the load balancing method provided in the embodiment of the present invention, and referring to fig. 2, the flow may include:
step S10, the Kubernetes cluster sends the configuration information of the service to the Nginx manager;
step S20, the Nginx manager creates a configuration file for the target service in the Kubernetes cluster according to the configuration information of the service;
step S30, determining an access data stream corresponding to the target service by the Nginx manager according to a preset load balancing strategy;
step S40, the Nginx manager sends the configuration file corresponding to the target service and the access data stream to the Nginx server;
and step S50, the Nginx server forwards the access data stream to a target service in the Kubernetes cluster according to the configuration file.
It should be noted that, in the embodiment of the present invention, a plurality of nginnx servers are correspondingly controlled under one nginnx manager, and a plurality of kubernets clusters also exist, so that one nginnx server may correspond to one kubernets cluster, and one nginnx server may also correspond to a plurality of kubernets clusters.
Fig. 3 is another schematic structural diagram of a load balancing system according to an embodiment of the present invention, and referring to fig. 3, the load balancing system may include: a Nginx manager 20, a Nginx server 21, a Kubernets cluster 22, and a Kubernets cluster manager 23.
The Kubernetes cluster manager is used for creating services in the Kubernetes cluster and configuring configuration information of the services.
In the following, the load balancing method provided by the embodiment of the present invention is introduced from the perspective of the Nginx manager, and the load balancing method described below may be referred to in correspondence with the signaling flow content described above.
Fig. 4 is a flowchart of a load balancing method according to an embodiment of the present invention, where the method is applicable to the Nginx manager, and referring to fig. 4, the method may include:
step S100, receiving configuration information of the service from a Kubernetes cluster;
the Nginx manager is connected with APIs (application programming interfaces) of multiple kubernets clusters, and after monitoring that creation of a new service exists in a kubernets cluster, the APIs of the kubernets cluster acquire configuration information of the newly created service and then send the acquired configuration information of the newly created service to the Nginx manager.
On the other hand, the Nginx manager in the embodiment of the present invention also obtains the creation of a new service in the kubernets cluster through the watch mechanism.
Similarly, after the API of the kubernets cluster monitors that the configuration information of the service in the kubernets cluster is updated, the updated configuration information of the service is sent to the Nginx manager.
A service corresponds to a kind of configuration information, the contents of the configuration information of different services are different, the configuration information of the service at least includes: container address, service domain name, service port, and various annotation information of the service, etc., which are not specifically limited in the embodiments of the present invention.
The service domain name is used to uniquely identify a service, and optionally, the service domain name may be in the form of: the service name-namespace-unified suffix mainly bears the position information of the service in the kubernets cluster, and the embodiment of the invention is not specifically limited to the specific content of the unified suffix. The domain name of the service in the embodiment of the present invention is mainly resolved to the Nginx manager through a DNS (domain name system, domain name system (service) protocol).
A service corresponds to a unique service port, and the same service has the same service port in different kubernets.
Step S110, establishing a configuration file for the target service in the Kubernetes cluster according to the configuration information of the service;
after receiving the configuration information of all services, the Nginx manager determines a target service needing to create a configuration file in the Nginx manager according to the configuration information of the services; and creating a configuration file for the target service according to the configuration information of the target service.
Specifically, the Nginx manager judges whether the configuration information of any service contains a preset identifier, and if so, creates a configuration file for a target service containing the preset identifier; and for the target service which does not contain the preset identification, a configuration file is not created. Specifically, it is determined whether the annotation information in the configuration information of any service includes the annotation of domain, and if so, a configuration file is created for the target service including the annotation of domain.
The process of creating a configuration file for the target service in the Kubernetes cluster is as follows: integrating the relevant configuration information corresponding to the target service into a configuration file form, specifically, one service corresponds to only one configuration file, and the configuration file at least comprises the following information: a container address, a domain name of the service, a type of the service (e.g., whether the service is a service directly registering the container, etc.), a port nodoport of the service, and the like.
Specifically, the Nginx manager in the embodiment of the present invention further receives update configuration information of the target service from the kubernets cluster; and updating the configuration file corresponding to the target service by using the updated configuration information of the target service.
In the Kubernetes cluster, regardless of whether the configuration information (for example, Pod address) of the container corresponding to the target service is updated or the configuration information of the target service is updated, the updated information is sent to the Nginx manager, and the Nginx manager updates the configuration file corresponding to the target service by using the updated information.
The updating process may specifically be adding new configuration information to the configuration file, and the old configuration information may be deleted or retained.
When a service in the kubernets cluster is deleted, the configuration file corresponding to the service stored in the corresponding Nginx manager is also deleted.
Optionally, in the embodiment of the present invention, service creation is mainly performed in a kubernets cluster through a kubernets cluster manager (for example, ipaas), where the kubernets cluster manager is configured to create a service in the kubernets cluster and configure configuration information of the service, and when the kubernets cluster manager performs service creation, the kubernets cluster manager calls interfaces of multiple kubernets clusters, and the service creation service, attribute information Deployment corresponding to the service, and configuration file configuration map of the service respectively include at least: the domain name of the service, the mirror version of the service, the number of copies of the service, the environment variable of the service, and the like.
Step S120, determining an access data stream corresponding to the target service according to a preset load balancing strategy;
the load balancing policy is, for example: load averaging strategy, weight strategy, minimum connection number strategy, polling strategy, IPhash strategy and the like.
The load averaging strategy refers to the load averaging on the target service in the Kubernetes cluster; the weight strategy is mainly to calculate the weight according to the response time of the target service, select the target service according to the obtained weight, and the probability that the target service with shorter corresponding time is selected is higher; the minimum connection number strategy is used for carrying out load balancing according to the current connection condition of the target service, and when the access data flow comes, the target service with the minimum current connection number is selected to process the access data flow; the polling strategy is to distribute the access data flow to target service in Kubernetes cluster in turn; the iphhash policy is to direct the access data streams with the same source IP address to the same target service.
Optionally, the access data stream corresponding to the target service in the embodiment of the present invention includes:
access data flow between kubernets clusters in a kubernets system and/or access data flow outside the kubernets system.
That is, the data flow to be allocated for which the nginnx manager is directed may be an access data flow between kubernets clusters, and may also be an access data flow outside the kubernets system. Therefore, the embodiment of the present invention may perform balanced distribution not only on access data streams between the kubernets cluster and the kubernets cluster, but also on access data streams from outside the kubernets system, and the embodiment of the present invention is not particularly limited.
Step S130, sending the configuration file corresponding to the target service and the access data stream to a Nginx server, and enabling the Nginx server to forward the access data stream to the target service in the Kubernetes cluster according to the configuration file.
The Nginx server may obtain relevant configuration information of the target service from the configuration file, for example, the port of the service, the IP address of the container, or the like, which is located to the storage location of the target service in the kubernets cluster, and then forward the access data stream to the target service in the kubernets cluster.
After sending the configuration file corresponding to the target service and the access data stream to the Nginx server, the Nginx manager also sends loading indication information of 'Nginx-srreload' to the Nginx server, so that the target Nginx server loads the configuration information according to the 'Nginx-srreload'.
The Nginx-srreload can instruct the Nginx server to load the configuration file and access the data stream without interrupting the service running per se, thereby avoiding the influence on the running state of the Nginx server.
It should be noted that the target service may specifically refer to a service located in the same kubernets cluster, or may also refer to a service located in different kubernets clusters, that is, in the embodiment of the present invention, load balancing adjustment may be performed on a service in the same kubernets cluster, or may also be performed on a service located in different kubernets clusters.
The method in the embodiment of the invention comprises the following steps: the Kubernetes cluster sends configuration information of the service to an Nginx manager, and the Nginx manager creates a configuration file for a target service in the Kubernetes cluster according to the configuration information of the service; determining an access data stream corresponding to the target service according to a preset load balancing strategy; sending a configuration file corresponding to the target service and an access data stream to an Nginx server; and the Nginx server forwards the access data stream to a target service in the Kubernetes cluster according to the configuration file. The Nginx manager can determine the access data flow corresponding to the target service according to a preset load balancing strategy, and realize uniform balanced distribution of the access data flow corresponding to the target service in the Kubernets cluster, so that the load balancing of the service in the Kubernets cluster is realized, uniform management of the service in the Kubernets cluster is further realized, and uniform distribution of the access data flow is also realized.
According to the embodiment of the invention, the services in the Kubernetes cluster are uniformly registered in the Nginx manager, and the registration of the services can be completed without a registration center of a third party.
By the method, the load balance of the services in the Kubernets clusters can be realized, the access data streams can be distributed to the clusters, after a certain cluster fails, the access data streams can be distributed to other clusters which do not fail, and the high availability of the services in the Kubernets clusters is guaranteed.
Optionally, the embodiment of the present invention further provides a terminal visualization interface connected to the Nginx manager, and a user may view the operation status of each service in the kubernets cluster and the allocation condition of the access data stream through the terminal visualization interface, and may visually present differences between each service configuration and the Nginx configuration in the kubernets cluster through the visualization interface, thereby improving a user experience level.
The Nginx manager in the embodiment of the present invention may also monitor an external request amount of the Nginx, including a normal access request and an abnormal request traffic with HTTP return codes of 4xx and 5 xx.
In order to further improve the load balancing effect, an embodiment of the present invention provides another load balancing method, and fig. 5 is a flowchart of the load balancing method provided in the embodiment of the present invention, where the method is applicable to the Nginx manager, and referring to fig. 5, the method may include:
step S200, receiving configuration information of the service from the Kubernets cluster;
step S210, according to the configuration information of the service, a configuration file is established for the target service in the Kubernetes cluster;
step S220, determining an access data stream corresponding to the target service according to a preset load balancing strategy;
step S230, sending a configuration file corresponding to the target service and an access data stream to a Nginx server, so that the Nginx server forwards the access data stream to the target service in a Kubernetes cluster according to the configuration file;
steps S200 to S230 in the embodiment of the present invention are the same as steps S100 to S130 in the above steps, and specific contents may be referred to correspondingly.
In order to realize monitoring of the Nginx server, the Nginx manager in the embodiment of the invention also sends a heartbeat check instruction to the Nginx server, monitors the operation condition of the Nginx server according to the response information of the Nginx server, and sends out an abnormal alarm prompt in time under the condition that the operation fault of the Nginx server is monitored, so as to ensure the normal operation of the Nginx cluster.
Meanwhile, if the Nginx server detects that the access data stream sent to the Kubernetes cluster fails to be sent, the Nginx server also sends alarm information to the Nginx manager in time to prompt that the access data stream fails to be sent, and requests to resend or perform other processing.
Step S240, sending traffic monitoring instruction information to a nginnx server, so that the nginnx server monitors traffic of an access data stream sent to the Kubernetes cluster.
The method includes that a Nginx server monitors the flow of access data flow sent to a Kubernets cluster by sending flow monitoring indication information to the Nginx server, and specifically, the flow to be monitored includes both the access flow between the Kubernets cluster and the access flow outside a Kubernets system. When the Nginx server monitors that the flow of the access data stream corresponding to a certain Kubernetes cluster reaches the access flow threshold corresponding to the Kubernetes cluster, sending indication information to the Nginx manager to indicate the Nginx manager to adjust a load balancing policy for the Kubernetes cluster, for example, the Nginx manager may time limit partial access data streams according to the indication information, for example, limit the issuing of low-priority service access data streams, and only allow the issuing of high-priority service access data streams.
In the embodiment of the invention, the Nginx server monitors the flow of the access data stream sent to the Kubernetes cluster and sends the monitoring result to the Nginx manager, so that the Nginx manager can timely adjust the load balancing strategy of the Kubernetes cluster, namely, the accuracy of the load balancing strategy adjustment is improved in a feedback adjustment mode.
In the following, the load balancing apparatus provided in the embodiments of the present invention is introduced, and the load balancing apparatus described below may be referred to in correspondence with the load balancing method described above.
Fig. 6 is a block diagram of a load balancing apparatus according to an embodiment of the present invention, where the load balancing apparatus may specifically be an Nginx manager, and referring to fig. 6, the load balancing apparatus may include:
a configuration information receiving unit 300, configured to receive configuration information of a service from a kubernets cluster;
a configuration file creating unit 310, configured to create a configuration file for a target service in the Kubernetes cluster according to the configuration information of the service;
an access data stream determining unit 320, configured to determine, according to a preset load balancing policy, an access data stream corresponding to the target service;
a sending unit 330, configured to send a configuration file corresponding to the target service and an access data stream to an nginnx server, so that the nginnx server forwards the access data stream to the target service in the Kubernetes cluster according to the configuration file.
The profile creating unit 310 includes:
the target service determining unit is used for determining a target service needing to create a configuration file in the Nginx manager according to the configuration information of the service;
and the configuration file creating subunit is used for creating a configuration file for the target service according to the configuration information of the target service.
The load balancing apparatus further includes:
an update configuration information receiving unit, configured to receive update configuration information of a target service from the kubernets cluster;
and the updating unit is used for updating the configuration file corresponding to the target service by using the updated configuration information of the target service.
The load balancing apparatus further includes:
and the monitoring indication information sending unit is used for sending flow monitoring indication information to the Nginx server so that the Nginx server monitors the flow of the access data flow sent to the Kubernetes cluster.
The access data stream corresponding to the target service comprises:
access data flow between kubernets clusters in a kubernets system and/or access data flow outside the kubernets system.
In summary, the present invention provides a load balancing method, device and system, wherein the method includes: the Kubernetes cluster sends configuration information of the service to an Nginx manager, and the Nginx manager creates a configuration file for a target service in the Kubernetes cluster according to the configuration information of the service; determining an access data stream corresponding to the target service according to a preset load balancing strategy; sending a configuration file corresponding to the target service and an access data stream to an Nginx server; and the Nginx server forwards the access data stream to a target service according to the configuration file. The Nginx manager can determine the access data flow corresponding to the target service according to a preset load balancing strategy, and realize uniform balanced distribution of the access data flow corresponding to the target service in the Kubernets cluster, so that the load balancing of the service in the Kubernets cluster is realized.
The embodiments in the present description are described in a progressive manner, each embodiment focuses on differences from other embodiments, and the same and similar parts among the embodiments are referred to each other. The device disclosed by the embodiment corresponds to the method disclosed by the embodiment, so that the description is simple, and the relevant points can be referred to the method part for description.
Those of skill would further appreciate that the various illustrative elements and algorithm steps described in connection with the embodiments disclosed herein may be implemented as electronic hardware, computer software, or combinations of both, and that the various illustrative components and steps have been described above generally in terms of their functionality in order to clearly illustrate this interchangeability of hardware and software. Whether such functionality is implemented as hardware or software depends upon the particular application and design constraints imposed on the implementation. Skilled artisans may implement the described functionality in varying ways for each particular application, but such implementation decisions should not be interpreted as causing a departure from the scope of the present invention.
The steps of a method or algorithm described in connection with the embodiments disclosed herein may be embodied directly in hardware, in a software module executed by a processor, or in a combination of the two. A software module may reside in Random Access Memory (RAM), memory, Read Only Memory (ROM), electrically programmable ROM, electrically erasable programmable ROM, registers, hard disk, a removable disk, a CD-ROM, or any other form of storage medium known in the art.
The previous description of the disclosed embodiments is provided to enable any person skilled in the art to make or use the present invention. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the generic principles defined herein may be applied to other embodiments without departing from the spirit or scope of the invention. Thus, the present invention is not intended to be limited to the embodiments shown herein but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.

Claims (10)

1. A load balancing method is applied to an Nginx manager, and comprises the following steps:
receiving configuration information of the service from the Kubernetes cluster;
according to the configuration information of the service, a configuration file is created for the target service in the Kubernetes cluster;
determining an access data stream corresponding to the target service according to a preset load balancing strategy;
and sending the configuration file corresponding to the target service and the access data stream to a Nginx server, so that the Nginx server forwards the access data stream to the target service in the Kubernetes cluster according to the configuration file.
2. The method of claim 1, wherein the creating a configuration file for a target service in the kubernets cluster according to the configuration information of the service comprises:
determining a target service needing to create a configuration file in an Nginx manager according to the configuration information of the service;
and creating a configuration file for the target service according to the configuration information of the target service.
3. The method of claim 1, further comprising:
receiving updated configuration information of a target service from the Kubernetes cluster;
and updating the configuration file corresponding to the target service by using the updated configuration information of the target service.
4. The method of claim 1, further comprising:
and sending traffic monitoring indication information to a Nginx server, so that the Nginx server monitors the traffic of the access data stream sent to the Kubernetes cluster.
5. The method of claim 1, wherein the access data flow corresponding to the target service comprises:
access data flow between kubernets clusters in a kubernets system and/or access data flow outside the kubernets system.
6. A load balancing apparatus applied to a Nginx manager, the apparatus comprising:
a configuration information receiving unit, configured to receive configuration information of a service from a kubernets cluster;
a configuration file creating unit, configured to create a configuration file for a target service in the Kubernetes cluster according to the configuration information of the service;
the access data flow determining unit is used for determining the access data flow corresponding to the target service according to a preset load balancing strategy;
and the sending unit is used for sending the configuration file corresponding to the target service and the access data stream to an Nginx server, so that the Nginx server forwards the access data stream to the target service in the Kubernetes cluster according to the configuration file.
7. The apparatus of claim 6, wherein the profile creating unit comprises:
the target service determining unit is used for determining a target service needing to create a configuration file in the Nginx manager according to the configuration information of the service;
and the configuration file creating subunit is used for creating a configuration file for the target service according to the configuration information of the target service.
8. The apparatus of claim 6, further comprising:
an update configuration information receiving unit, configured to receive update configuration information of a target service from the kubernets cluster;
and the updating unit is used for updating the configuration file corresponding to the target service by using the updated configuration information of the target service.
9. A load balancing system, characterized in that the system comprises at least: a Nginx manager, a Nginx server, and a Kubernetes cluster;
the Kubernetes cluster is used for sending configuration information of the service to the Nginx manager;
the Nginx manager is used for creating a configuration file for the target service in the Kubernetes cluster according to the configuration information of the service; determining an access data stream corresponding to the target service according to a preset load balancing strategy; sending a configuration file corresponding to the target service and an access data stream to an Nginx server;
and the Nginx server is used for forwarding the access data stream to a target service in a Kubernetes cluster according to the configuration file.
10. The system of claim 9, further comprising:
the Kubernets cluster manager is used for creating services in the Kubernets cluster and configuring configuration information of the services.
CN202010119796.8A 2020-02-26 2020-02-26 Load balancing method, device and system Active CN111367662B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010119796.8A CN111367662B (en) 2020-02-26 2020-02-26 Load balancing method, device and system

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010119796.8A CN111367662B (en) 2020-02-26 2020-02-26 Load balancing method, device and system

Publications (2)

Publication Number Publication Date
CN111367662A true CN111367662A (en) 2020-07-03
CN111367662B CN111367662B (en) 2023-06-02

Family

ID=71208102

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010119796.8A Active CN111367662B (en) 2020-02-26 2020-02-26 Load balancing method, device and system

Country Status (1)

Country Link
CN (1) CN111367662B (en)

Cited By (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111897641A (en) * 2020-08-03 2020-11-06 海信电子科技(武汉)有限公司 Micro-service monitoring and scheduling method and display equipment
CN112948127A (en) * 2021-03-30 2021-06-11 北京滴普科技有限公司 Cloud platform container average load monitoring method, terminal device and readable storage medium
CN113032105A (en) * 2021-04-20 2021-06-25 金蝶软件(中国)有限公司 Kubernetes cluster access control method, system and related equipment
CN113783922A (en) * 2021-03-26 2021-12-10 北京沃东天骏信息技术有限公司 Load balancing method, system and device
CN113949707A (en) * 2021-09-30 2022-01-18 上海浦东发展银行股份有限公司 OpenResty and K8S-based container cloud service discovery and load balancing method
CN114070889A (en) * 2021-11-10 2022-02-18 北京百度网讯科技有限公司 Configuration method, traffic forwarding method, device, storage medium, and program product
CN115134424A (en) * 2022-06-29 2022-09-30 中国工商银行股份有限公司 Load balancing method, apparatus, computer device, storage medium and program product
CN115633084A (en) * 2022-12-01 2023-01-20 苏州浪潮智能科技有限公司 K8s cluster access method and device and computer readable storage medium

Citations (12)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106888254A (en) * 2017-01-20 2017-06-23 华南理工大学 A kind of exchange method between container cloud framework based on Kubernetes and its each module
CN106953758A (en) * 2017-03-20 2017-07-14 北京搜狐新媒体信息技术有限公司 A kind of dynamic allocation management method and system based on Nginx servers
CN107302604A (en) * 2017-06-30 2017-10-27 挖财网络技术有限公司 PaaS platform method for configuring domain name and device and electronic equipment based on Kubernetes
CN107317887A (en) * 2017-08-23 2017-11-03 北京知道创宇信息技术有限公司 A kind of load-balancing method, device and system
CN108039975A (en) * 2017-12-21 2018-05-15 北京搜狐新媒体信息技术有限公司 Container cluster management system and its application process
CN108551488A (en) * 2018-05-03 2018-09-18 山东汇贸电子口岸有限公司 Distributed container cluster load balancing method based on domestic CPU and OS
CN108965381A (en) * 2018-05-31 2018-12-07 康键信息技术(深圳)有限公司 Implementation of load balancing, device, computer equipment and medium based on Nginx
US20180373505A1 (en) * 2017-06-21 2018-12-27 Ca, Inc. Systems and methods for transforming service definitions in a multi-service containerized application
CN109347947A (en) * 2018-10-15 2019-02-15 郑州云海信息技术有限公司 A kind of method of load balancing, name server and cluster nas server
CN110113399A (en) * 2019-04-24 2019-08-09 华为技术有限公司 Load balancing management method and relevant apparatus
US20190289009A1 (en) * 2017-10-04 2019-09-19 Palantir Technologies Inc. Controlling user creation of data resources on a data processing platform
CN110837418A (en) * 2019-11-06 2020-02-25 浪潮云信息技术有限公司 High-concurrency web system based on container and implementation method

Patent Citations (12)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106888254A (en) * 2017-01-20 2017-06-23 华南理工大学 A kind of exchange method between container cloud framework based on Kubernetes and its each module
CN106953758A (en) * 2017-03-20 2017-07-14 北京搜狐新媒体信息技术有限公司 A kind of dynamic allocation management method and system based on Nginx servers
US20180373505A1 (en) * 2017-06-21 2018-12-27 Ca, Inc. Systems and methods for transforming service definitions in a multi-service containerized application
CN107302604A (en) * 2017-06-30 2017-10-27 挖财网络技术有限公司 PaaS platform method for configuring domain name and device and electronic equipment based on Kubernetes
CN107317887A (en) * 2017-08-23 2017-11-03 北京知道创宇信息技术有限公司 A kind of load-balancing method, device and system
US20190289009A1 (en) * 2017-10-04 2019-09-19 Palantir Technologies Inc. Controlling user creation of data resources on a data processing platform
CN108039975A (en) * 2017-12-21 2018-05-15 北京搜狐新媒体信息技术有限公司 Container cluster management system and its application process
CN108551488A (en) * 2018-05-03 2018-09-18 山东汇贸电子口岸有限公司 Distributed container cluster load balancing method based on domestic CPU and OS
CN108965381A (en) * 2018-05-31 2018-12-07 康键信息技术(深圳)有限公司 Implementation of load balancing, device, computer equipment and medium based on Nginx
CN109347947A (en) * 2018-10-15 2019-02-15 郑州云海信息技术有限公司 A kind of method of load balancing, name server and cluster nas server
CN110113399A (en) * 2019-04-24 2019-08-09 华为技术有限公司 Load balancing management method and relevant apparatus
CN110837418A (en) * 2019-11-06 2020-02-25 浪潮云信息技术有限公司 High-concurrency web system based on container and implementation method

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
刘泰玮: "基于Docker的容器集群部署管理平台的设计与实现", 《中国优秀硕士学位论文全文数据库信息科技辑》, no. 12, pages 138 - 308 *

Cited By (13)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111897641A (en) * 2020-08-03 2020-11-06 海信电子科技(武汉)有限公司 Micro-service monitoring and scheduling method and display equipment
CN113783922A (en) * 2021-03-26 2021-12-10 北京沃东天骏信息技术有限公司 Load balancing method, system and device
CN112948127B (en) * 2021-03-30 2023-11-10 北京滴普科技有限公司 Cloud platform container average load monitoring method, terminal equipment and readable storage medium
CN112948127A (en) * 2021-03-30 2021-06-11 北京滴普科技有限公司 Cloud platform container average load monitoring method, terminal device and readable storage medium
CN113032105A (en) * 2021-04-20 2021-06-25 金蝶软件(中国)有限公司 Kubernetes cluster access control method, system and related equipment
CN113032105B (en) * 2021-04-20 2023-11-17 金蝶软件(中国)有限公司 Kubernetes cluster access control method, system and related equipment
CN113949707A (en) * 2021-09-30 2022-01-18 上海浦东发展银行股份有限公司 OpenResty and K8S-based container cloud service discovery and load balancing method
CN113949707B (en) * 2021-09-30 2024-04-30 上海浦东发展银行股份有限公司 OpenResty and K8S-based container cloud service discovery and load balancing method
CN114070889B (en) * 2021-11-10 2023-11-14 北京百度网讯科技有限公司 Configuration method, traffic forwarding device, storage medium, and program product
CN114070889A (en) * 2021-11-10 2022-02-18 北京百度网讯科技有限公司 Configuration method, traffic forwarding method, device, storage medium, and program product
CN115134424A (en) * 2022-06-29 2022-09-30 中国工商银行股份有限公司 Load balancing method, apparatus, computer device, storage medium and program product
CN115134424B (en) * 2022-06-29 2024-02-02 中国工商银行股份有限公司 Load balancing method, load balancing device, computer equipment, storage medium and program product
CN115633084A (en) * 2022-12-01 2023-01-20 苏州浪潮智能科技有限公司 K8s cluster access method and device and computer readable storage medium

Also Published As

Publication number Publication date
CN111367662B (en) 2023-06-02

Similar Documents

Publication Publication Date Title
CN111367662B (en) Load balancing method, device and system
CN112868206B (en) Method, system and computer readable medium for providing service broker functionality
CN109104483B (en) Micro-service dynamic load balancing method and device based on event notification
US11057274B1 (en) Systems and methods for validation of virtualized network functions
CN110971449A (en) Service management and control system based on micro-service architecture
US10389801B2 (en) Service request processing method, related apparatus, and system
US20050144261A1 (en) Selective update of console parameters from other consoles
CN110995873A (en) Gateway service interface discovery method, system, electronic device and storage medium
US20130346513A1 (en) Migrating a chat message service provided by a chat server to a new chat server
CN106528214B (en) A kind of installation method of OS, server and system
CA2550879A1 (en) License distribution in a packet data network
CN106708539B (en) Client updating method and device
CN113630266A (en) Method and device for instantiating edge application server
CN114364031A (en) Service providing method, device and storage medium
CN109413117B (en) Distributed data calculation method, device, server and computer storage medium
CN116781564B (en) Network detection method, system, medium and electronic equipment of container cloud platform
CN115051978B (en) Equipment monitoring implementation method and system
US20210336849A1 (en) Method for configuring a network node
CN113992685B (en) Service controller determining method, system and device
US20230102122A1 (en) Methods, systems, and computer readable media for identifying alternate delivery endpoints for mobile originated data and monitoring reports in a communications network
CN112148320A (en) Application program upgrading method, device, equipment and storage medium
JP4170649B2 (en) Messenger server system, method of providing messenger service, connection destination determination server in messenger service
CN115460075A (en) Multi-network mode implementation method, device, equipment and medium based on cloud-native
US20230146880A1 (en) Management system and management method
WO2015196769A1 (en) Method for processing data in iptv system, and network element device

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant