A method, apparatus, cluster deployment system, and storage medium for external exposure
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-07-12
- Publication Date
- 2026-08-14
AI Technical Summary
[0006]本发明实施例提供了一种对外暴露方法、装置、集群部署系统及存储介质,以解决传统的对外暴露方法需要外部客户端多次发送对外暴露请求的问题,避免外部客户端访问多个路由地址的情况,从而提高外部客户端与部署集群端的流量传输效率
[0022] The technical solution of this invention establishes an application identifier for the deployed application on the load balancer synchronous deployment cluster. It stores the application identifier, the load balancer's corresponding load routing address, and the node port addresses corresponding to at least two deployment clusters and the deployed application, respectively. In response to detecting an external client's exposure request, the load balancer sends the load routing address corresponding to the application identifier in the exposure request to the external client. In response to detecting service traffic data sent by the external client through accessing the load routing address, the load balancer obtains at least two node port addresses corresponding to the load routing address and sends the service traffic data to the application nodes of the deployment clusters corresponding to each of the aforementioned node port addresses. By establishing a mapping relationship between an application identifier, a load routing address, and multiple node port addresses through the load balancer, the external client only needs to send one exposure request and access one load routing address to achieve traffic transmission with the deployment cluster. This solves the problem of traditional exposure methods requiring multiple exposure requests from the external client and avoids the situation where the external client accesses multiple routing addresses, thereby improving the traffic transmission efficiency between the external client and the deployment cluster.
Smart Images

Figure CN116886775B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of computer technology, and in particular to a method, apparatus, cluster deployment system, and storage medium for external exposure. Background Technology
[0002] A Kubernetes cluster is a container orchestration system used to manage and deploy containerized applications. During the operation of a Kubernetes cluster, it is usually necessary to expose services to the outside world for the application in order to route external traffic to the node where the application resides.
[0003] The traditional method of external exposure is to send the routing address used for traffic transmission to the external client in response to the detection of an external client's external exposure request, so that the external client can access it.
[0004] In the process of realizing this invention, at least the following technical problems were found in the prior art:
[0005] As Kubernetes clusters become increasingly popular, more and more companies are operating multiple Kubernetes clusters, which may result in the same application being deployed on multiple Kubernetes clusters. When an external client needs to send external traffic to a particular application, traditional methods of external exposure require the external client to send multiple external exposure requests to the deployment cluster and access multiple returned routing addresses, leading to low traffic transmission efficiency between the external client and multiple Kubernetes clusters. Summary of the Invention
[0006] This invention provides an external exposure method, apparatus, cluster deployment system, and storage medium to solve the problem that traditional external exposure methods require external clients to send external exposure requests multiple times, thereby avoiding the situation where external clients access multiple routing addresses and improving the traffic transmission efficiency between external clients and the deployment cluster.
[0007] According to an embodiment of the present invention, an external exposure method is provided, the method comprising:
[0008] In response to detecting the application identifier of the deployed application synchronized from the deployment cluster, obtain the node port addresses corresponding to at least two deployment clusters and the deployed application respectively in the deployment cluster.
[0009] Store the application identifier, the load balancer and the load routing address corresponding to the deployed application, and the port address of each node;
[0010] In response to detecting an external exposure request sent by an external client, the load routing address corresponding to the application identifier in the external exposure request is sent to the external client;
[0011] In response to detecting that the external client sends service traffic data by accessing the load routing address, the system obtains at least two node port addresses corresponding to the load routing address and sends the service traffic data to the application nodes of the deployment cluster corresponding to each of the node port addresses.
[0012] According to another embodiment of the present invention, an externally exposed device is provided, the device comprising:
[0013] The node port address acquisition module is used to acquire the node port addresses corresponding to at least two deployment clusters and the deployment application, respectively, in response to detecting the application identifier of the deployment application synchronized from the deployment cluster end.
[0014] The node port address storage module is used to store the application identifier, the load balancer and the load routing address corresponding to the deployed application, and the corresponding node port addresses.
[0015] The load routing address sending module is used to send the load routing address corresponding to the application identifier in the external exposure request to the external client in response to the detection of an external client's external exposure request;
[0016] The service traffic data sending module is used to respond to the detection that the external client sends service traffic data by accessing the load routing address, obtain at least two node port addresses corresponding to the load routing address, and send the service traffic data to the application nodes of the deployment cluster corresponding to each of the node port addresses.
[0017] According to another embodiment of the present invention, a cluster deployment system is provided, the cluster deployment system comprising: a deployment cluster terminal, an external client, and a load balancer, wherein the deployment cluster terminal and the external client are respectively communicatively connected to the load balancer;
[0018] The deployment cluster includes at least two deployment clusters, and each deployment cluster deploys at least one application.
[0019] The external client is used to send external exposure requests and business traffic data to the load balancer;
[0020] The load balancer includes: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores a computer program executable by the at least one processor, the computer program being executed by the at least one processor to enable the at least one processor to perform the external exposure method described in any embodiment of the present invention.
[0021] According to another embodiment of the present invention, a computer-readable storage medium is provided, the computer-readable storage medium storing computer instructions, the computer instructions being configured to cause a processor to execute and implement the external exposure method described in any embodiment of the present invention.
[0022] The technical solution of this invention establishes an application identifier for the deployed application on the load balancer synchronous deployment cluster. It stores the application identifier, the load balancer's corresponding load routing address, and the node port addresses corresponding to at least two deployment clusters and the deployed application, respectively. In response to detecting an external client's exposure request, the load balancer sends the load routing address corresponding to the application identifier in the exposure request to the external client. In response to detecting service traffic data sent by the external client through accessing the load routing address, the load balancer obtains at least two node port addresses corresponding to the load routing address and sends the service traffic data to the application nodes of the deployment clusters corresponding to each of the aforementioned node port addresses. By establishing a mapping relationship between an application identifier, a load routing address, and multiple node port addresses through the load balancer, the external client only needs to send one exposure request and access one load routing address to achieve traffic transmission with the deployment cluster. This solves the problem of traditional exposure methods requiring multiple exposure requests from the external client and avoids the situation where the external client accesses multiple routing addresses, thereby improving the traffic transmission efficiency between the external client and the deployment cluster.
[0023] It should be understood that the description in this section is not intended to identify key or essential features of the embodiments of the present invention, nor is it intended to limit the scope of the invention. Other features of the invention will become readily apparent from the following description. Attached Figure Description
[0024] To more clearly illustrate the technical solutions in the embodiments of the present invention, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0025] Figure 1 A flowchart illustrating an external exposure method provided in one embodiment of the present invention;
[0026] Figure 2 This is a schematic diagram illustrating the allocation of service traffic data according to an embodiment of the present invention;
[0027] Figure 3 A flowchart illustrating another external exposure method provided in one embodiment of the present invention;
[0028] Figure 4 A flowchart illustrating a method for generating an address mapping pool according to an embodiment of the present invention;
[0029] Figure 5 This is a schematic diagram of the structure of an externally exposed device provided in one embodiment of the present invention;
[0030] Figure 6 This is a schematic diagram of the structure of a cluster deployment system provided in one embodiment of the present invention;
[0031] Figure 7 This is a schematic diagram of a load balancer provided in one embodiment of the present invention. Detailed Implementation
[0032] To enable those skilled in the art to better understand the present invention, the technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings of the embodiments of the present invention. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort should fall within the scope of protection of the present invention.
[0033] It should be noted that the terms "comprising" and "having" and any variations thereof in the specification, claims and accompanying drawings of this invention are intended to cover non-exclusive inclusion. For example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units that are explicitly listed, but may include other steps or units that are not explicitly listed or that are inherent to such processes, methods, products or devices.
[0034] Figure 1 This is a flowchart illustrating an external exposure method according to an embodiment of the present invention. This embodiment is applicable to situations where applications deployed in multiple clusters are exposed to the outside world, enabling external clients to transmit traffic with the applications deployed in multiple clusters. This method can be executed by an external exposure device, which can be implemented in hardware and / or software and can be configured in a terminal device. Figure 1 As shown, the method includes:
[0035] S110. In response to detecting the application identifier of the deployed application synchronized from the deployment cluster end, obtain the node port addresses corresponding to at least two deployment clusters and the deployed application respectively in the deployment cluster end.
[0036] Specifically, the deployment cluster includes at least two deployment clusters, each of which deploys at least one application. In this embodiment, the cluster type of the deployment cluster is a Kubernetes cluster.
[0037] Specifically, the load balancer is pre-configured with application deployment data that needs to be synchronized from the deployment cluster. This application deployment data includes at least the application identifier of the deployed application. For example, the application identifier can consist of one or more characters, such as letters, numbers, uppercase letters, lowercase letters, and special characters. The composition of the application identifier is not limited here.
[0038] In one specific embodiment, the method further includes: when listening to an application deployment event in the deployment cluster, synchronizing the application deployment data of the application corresponding to the application deployment event to the load balancer; and / or, when listening to an application update event in the deployment cluster, synchronizing the application deployment data of the application corresponding to the application update event to the load balancer.
[0039] In one specific embodiment, the application deployment data also includes at least two node port addresses corresponding to the application identifier synchronized with the deployment cluster. Specifically, the node port addresses are used to point to the deployment cluster that deploys the application corresponding to the application identifier, as well as the node IP address and node port exposed by the deployment cluster to the external environment of the deployment application. In this embodiment, the exposure service type used by the deployment cluster to expose the deployment application to the external environment is NodePort.
[0040] S120. Store the application identifier, the load balancer and the load routing address corresponding to the deployed application, and the port address of each node.
[0041] In one specific embodiment, the method further includes: obtaining the load port address corresponding to the application identifier of the deployed application; and generating a load routing address corresponding to the load balancer and the deployed application based on the load IP address and load port address of the load balancer.
[0042] Specifically, the load balancer IP address represents the access address of the load balancer, and the load balancer port address represents the port address exposed by the load balancer to external clients for accessing the deployed application. For example, the load balancer port address can be randomly generated or generated based on the application identifier. There is no limitation on the generation method of the load balancer port address; it can be customized according to actual needs.
[0043] Specifically, the application identifier, load balancing address, and port addresses of each node together constitute the address mapping pool for deploying applications.
[0044] S130. In response to detecting an external exposure request sent by an external client, the load routing address corresponding to the application identifier in the external exposure request is sent to the external client.
[0045] For example, suppose the load balancer synchronously stores application identifier 1 and application identifier 2. For application identifier 1, it stores load routing address 1, node port address 1.1, node port address 2.1, and node port address 3.1. For application identifier 2, it stores load routing address 2, node port address 1.2, node port address 2.2, and node port address 3.2. If the application identifier in the externally exposed request is application identifier 1, then load routing address 1 is sent to the external client; if the application identifier in the externally exposed request is application identifier 2, then load routing address 2 is sent to the external client.
[0046] S140. In response to detecting that an external client sends service traffic data by accessing the load routing address, obtain at least two node port addresses corresponding to the load routing address, and send the service traffic data to the application nodes of the deployment cluster corresponding to each node port address.
[0047] Based on the above embodiments, specifically, the application deployment data also includes: status data of application nodes in the deployment cluster to which the application belongs, and sending business traffic data to the application nodes of the deployment cluster corresponding to the port addresses of each node, including: sending business traffic data to the application nodes of the deployment cluster corresponding to the port addresses of each node based on the status data of each application node.
[0048] Specifically, the application node's status data is used to characterize whether the application node can receive and process business traffic data. For example, the application node's status data can be either healthy or faulty. When the application node's status data is healthy, business traffic data is sent to the application node based on the node's corresponding port address.
[0049] The advantage of this setup is that it ensures the performance of the cluster deployment in processing business traffic data sent from external clients.
[0050] In one specific embodiment, sending business traffic data to the application nodes of the deployment cluster corresponding to the port addresses of each node includes: obtaining the traffic allocation ratios corresponding to at least two deployment clusters to which the deployment application belongs; and for each deployment cluster, sending business traffic data to the application nodes of the deployment cluster based on the node port address and traffic allocation ratio corresponding to the deployment cluster.
[0051] In one specific embodiment, the traffic allocation ratio corresponding to each deployment cluster is preset. In another specific embodiment, obtaining the traffic allocation ratio corresponding to at least two deployment clusters to which the deployed application belongs includes: obtaining the cluster load data corresponding to at least two deployment clusters to which the deployed application belongs; and determining the traffic allocation ratio corresponding to each deployment cluster based on the cluster load data.
[0052] For example, cluster load data includes, but is not limited to, at least one of the following load data: memory utilization, CPU utilization, number of deployed applications, and total number of deployments. The number of applications represents the number of that specific application deployed in the cluster, and the total number of deployments represents the total number of all deployed applications in the cluster.
[0053] For example, the traffic allocation ratio for the deployment cluster is determined based on each load data and the load weight corresponding to each load data. The method for determining the traffic allocation ratio is not limited here, and can be customized according to actual needs.
[0054] Figure 2 This is a schematic diagram illustrating the allocation of service traffic data according to an embodiment of the present invention. Specifically, Figure 2 In this context, "Pod" represents the basic execution unit of an application deployed in a Kubernetes cluster. An external client sends 100% of its business traffic to the load balancer. Since application app1 is deployed in cluster A (4 instances) and in cluster B (2 instances), a larger proportion of the business traffic is allocated to cluster A. Figure 2 The 70% shown represents a smaller proportion of business traffic data being sent to deployment cluster B, such as... Figure 2 The figure shown is 30%.
[0055] The advantage of this setup is that it can effectively address the high concurrency of external traffic on the deployment cluster, ensuring the traffic processing performance of the deployment cluster and improving its throughput.
[0056] The technical solution in this embodiment sets the application identifier of the deployed application on the load balancer synchronously deploying the cluster, and establishes a mapping relationship between an application identifier, a load routing address, and multiple node port addresses. This allows external clients to send an external exposure request only once and access a single load routing address to achieve traffic transmission with the deployment cluster. This solves the problem that traditional external exposure methods require external clients to send multiple external exposure requests and avoids the situation where external clients access multiple routing addresses, thereby improving the traffic transmission efficiency between external clients and the deployment cluster.
[0057] Figure 3 This is a flowchart illustrating another method for external exposure provided in one embodiment of the present invention. This embodiment further refines the step of "obtaining the node port addresses corresponding to at least two deployment clusters and the deployment application in the above embodiment." For example... Figure 3 As shown, the method includes:
[0058] S210. In response to detecting the application identifier of the deployed application synchronized from the deployment cluster end, obtain the cluster interface addresses corresponding to at least two deployment clusters to which the deployed application synchronized from the deployment cluster end belongs.
[0059] In this embodiment, the application deployment data synchronized from the deployment cluster includes the application identifier of the deployed application and the cluster interface addresses corresponding to at least two deployment clusters to which the deployed application belongs. The cluster interface address is the access address of the API server in the deployment cluster.
[0060] For example, the deployment information or DaemonSet information of the application is synchronously deployed. The deployment information describes which deployment clusters the application is deployed in. There may be multiple deployments of the same application in the same deployment cluster. The DaemonSet information ensures that the application is deployed in each deployment cluster and that only one application is deployed in each deployment cluster. If a new deployment cluster is added, the application is automatically deployed in the new deployment cluster.
[0061] S220. For each cluster interface address, based on the application identifier, perform a query operation on the set of exposed services in the deployment cluster corresponding to the cluster interface address.
[0062] Specifically, the exposed service is a resource in the Kubernetes cluster used to describe the exposure of services. Deploying applications apply for exposed services in the deployment cluster through deployment. Specifically, the application identifier of the deployment application applying for exposed services is defined in the matadata.labels of the deployment description file, such as name: app1.
[0063] Specifically, the cluster interface address is invoked, and a query operation is performed on the set of exposed services in the deployment cluster corresponding to the cluster interface address based on the application identifier.
[0064] S230. Based on the query result data received from the deployment cluster, determine the node port address corresponding to the deployment cluster and the deployment application.
[0065] In one specific embodiment, the query result data includes the service application application status. When the service application status in the query result data is "application submitted", the query result data also includes the exposed service type applied for by the deployment application and the routing address corresponding to the exposed service type.
[0066] Specifically, if the set of exposed services in the deployment cluster defines an application identifier for the deployed application, the deployment cluster will set the service application status in the query result data to "application submitted" and add the exposed service type applied for by the deployed application and the routing address corresponding to the exposed service type to the query result data; if the set of exposed services in the deployment cluster does not define an application identifier for the deployed application, the deployment cluster will set the service application status in the query result data to "not applied".
[0067] Specifically, the exposed service types include ClusterIP and NodePort. The deployment cluster assigns a virtual IP address to each application requesting ClusterIP-type exposed services. This virtual IP address allows for balanced access to all pod nodes hosting the application within the deployment cluster. However, this virtual IP address is only accessible within the deployment cluster; it cannot be used to access the application from outside the cluster. The routing address corresponding to the ClusterIP type in the query results is this virtual IP address.
[0068] Based on the ClusterIP type virtual IP address, the deployment cluster also allocates a port address for the deployment application that requests the NodePort type exposure service, which is used to expose the deployment application to the outside world. The corresponding routing address for the NodePort type is NodeIP (node IP address): NodePort (port address).
[0069] In one specific embodiment, determining the node port address corresponding to the deployment cluster and the deployment application based on the received query result data sent by the deployment cluster includes: if the service application status in the query result data is "application completed" and the exposed service type in the query result data is NodePort type, generating the node port address corresponding to the deployment cluster and the deployment application based on the cluster interface address and the routing address in the query result data.
[0070] In one specific embodiment, determining the node port address corresponding to the deployment cluster and the deployment application based on the received query result data sent by the deployment cluster further includes: if the service application status in the query result data is "not applied for", or if the exposed service type in the query result data is "ClusterIP", obtaining the software development kit tool corresponding to the deployment cluster synchronized from the deployment cluster end; applying for a NodePort type exposed service in the exposed services of the deployment cluster based on the application identifier by calling the software development kit tool; and generating the node port address corresponding to the deployment cluster and the deployment application based on the cluster interface address and the route address sent by the deployment cluster.
[0071] For example, based on the cluster attribute data corresponding to the deployed cluster, a clientset is generated. Based on the application identifier, a NodePort type exposed service is declared and defined as service.yaml. Then, the namespace of the NodePort type exposed service is determined, and clientset.CoreV1().Services(namespace).Create(context.TODO(),service,metav1.CreateOptions{}) is executed to obtain the route address of the created exposed service. Here, clientset is the most commonly used client for calling Kubernetes cluster resource objects, context.TODO() is the context parameter, and metav1.CreateOptions{} are the default options when creating the service.
[0072] S240. Store the application identifier, the load balancer and the load routing address corresponding to the deployed application, and the port address of each node.
[0073] Figure 4 This is a flowchart of an address mapping pool generation method provided in an embodiment of the present invention. Specifically, the method involves obtaining application deployment data of the deployed application synchronized from the deployment cluster. Specifically, the application deployment data includes an application identifier and at least two cluster interface addresses. For each cluster interface address, the method determines whether the deployed application requests to expose services in the deployment cluster corresponding to the cluster interface address by accessing the cluster interface address. If it does, the method further determines whether the exposed service type of the deployed application is of type NodePort. If it is, a node port address is generated based on the cluster interface address and the routing address corresponding to the NodePort type.
[0074] If the deployed application does not request an exposed service in the deployment cluster corresponding to the cluster interface address, or if the exposed service type of the deployed application is ClusterIP, then the deployed application will request an exposed service of type NodePort in the deployment cluster, and a node port address will be generated based on the cluster interface address and the routing address corresponding to the NodePort type.
[0075] An address mapping pool for deployed applications is constructed based on the application identifier, load balancing address, and port addresses of each node.
[0076] S250. In response to detecting an external exposure request sent by an external client, the load routing address corresponding to the application identifier in the external exposure request is sent to the external client.
[0077] S260. In response to detecting that an external client sends service traffic data by accessing a load balancing address, obtain at least two node port addresses corresponding to the load balancing address, and send the service traffic data to the application nodes of the deployment cluster corresponding to each node port address.
[0078] In this embodiment, S240-S260 are the same as those described above. Figure 1 The S120-S140 shown are the same or similar, and will not be described again in this embodiment.
[0079] Due to the complex and variable deployment environment of load balancer clusters, there may be situations where deployed applications do not request exposed services in the deployment cluster, or the requested exposed service type is ClusterIP. This can prevent the load balancer from synchronizing node port addresses or the synchronized routing addresses may be unusable by the load balancer. The technical solution in this embodiment obtains the cluster interface addresses corresponding to at least two deployment clusters to which the deployed application belongs, synchronized from the deployment cluster. For each cluster interface address, based on the application identifier, a query operation is performed on the set of exposed services in the deployment cluster corresponding to the cluster interface address. Based on the query result data received from the deployment cluster, the node port addresses corresponding to the deployment cluster and the deployed application are determined. This solves the problem of inaccurate synchronization of node port addresses, improves the adaptability between the load balancer and the deployment cluster, and further improves the traffic transmission efficiency between external clients and the deployment cluster.
[0080] The following are embodiments of the external exposure device provided in this invention. This device and the external exposure method in the above embodiments belong to the same inventive concept. For details not described in detail in the embodiments of the external exposure device, please refer to the content on the external exposure method in the above embodiments.
[0081] Figure 5This is a schematic diagram of the structure of an externally exposed device according to an embodiment of the present invention. Figure 5 As shown, the device includes: a node port address acquisition module 310, a node port address storage module 320, a load routing address sending module 330, and a service traffic data sending module 340.
[0082] The node port address acquisition module 310 is used to acquire the node port addresses corresponding to at least two deployment clusters and the deployment application respectively in the deployment cluster in response to detecting the application identifier of the deployment application synchronized from the deployment cluster end.
[0083] The node port address storage module 320 is used to store the application identifier, the load balancer and the load routing address corresponding to the deployed application, and the corresponding node port address.
[0084] The load routing address sending module 330 is used to send the load routing address corresponding to the application identifier in the external exposure request to the external client in response to the detection of an external client's external exposure request;
[0085] The business traffic data sending module 340 is used to respond to the detection of business traffic data sent by an external client through accessing the load routing address, obtain at least two node port addresses corresponding to the load routing address, and send the business traffic data to the application nodes of the deployment cluster corresponding to each node port address.
[0086] The technical solution in this embodiment sets the application identifier of the deployed application on the load balancer synchronously deploying the cluster, and establishes a mapping relationship between an application identifier, a load routing address, and multiple node port addresses. This allows external clients to send an external exposure request only once and access a single load routing address to achieve traffic transmission with the deployment cluster. This solves the problem that traditional external exposure methods require external clients to send multiple external exposure requests and avoids the situation where external clients access multiple routing addresses, thereby improving the traffic transmission efficiency between external clients and the deployment cluster.
[0087] In one specific embodiment, the device further includes:
[0088] The load routing address generation module is used to obtain the load port address corresponding to the application identifier of the deployed application;
[0089] Based on the load balancer's load IP address and load port address, generate load routing addresses corresponding to the load balancer and the deployed application.
[0090] In one specific embodiment, the node port address acquisition module 310 includes:
[0091] The cluster interface address acquisition unit is used to acquire the cluster interface addresses corresponding to at least two deployment clusters to which the deployed application belongs, which are synchronized from the deployment cluster end.
[0092] The exposed service set query unit is used to perform a query operation on the exposed service set in the deployment cluster corresponding to each cluster interface address, based on the application identifier.
[0093] The node port address determination unit is used to determine the node port address corresponding to the deployment cluster and the deployment application based on the query result data sent by the deployment cluster.
[0094] In one specific embodiment, the query result data includes the service application application status. When the service application status in the query result data is "application submitted", the query result data also includes the exposed service type applied for by the deployment application and the routing address corresponding to the exposed service type.
[0095] In one specific embodiment, the exposed service set query unit is used for:
[0096] If the service application status in the query results is "application submitted" and the exposed service type in the query results is "NodePort", then the node port addresses corresponding to the deployment cluster and the deployment application are generated based on the cluster interface address and the routing address in the query results.
[0097] In one specific embodiment, the exposed service set query unit is further configured to:
[0098] If the service application status in the query results is "not applied" or the exposed service type in the query results is "ClusterIP", obtain the software development kit tools corresponding to the deployment cluster synchronized from the deployment cluster end;
[0099] By calling software development kit tools, based on the application identifier, a NodePort type exposure service is requested in the exposure services of the deployment cluster;
[0100] Based on the cluster interface address and the route address sent by the deployment cluster, generate the node port addresses corresponding to the deployment cluster and the deployment application.
[0101] In one specific embodiment, the service traffic data sending module 340 is specifically used for:
[0102] Obtain the traffic allocation ratios for at least the two deployment clusters to which the application belongs;
[0103] For each deployment cluster, business traffic data is sent to the application nodes of the deployment cluster based on the node port address and traffic allocation ratio corresponding to the deployment cluster.
[0104] The external exposure device provided in the embodiments of the present invention can execute the external exposure method provided in any embodiment of the present invention, and has the corresponding functional modules and beneficial effects of executing the method.
[0105] Figure 6 This is a schematic diagram of the structure of a cluster deployment system provided in one embodiment of the present invention, as shown below. Figure 6 As shown, the cluster deployment system 400 includes a deployment cluster terminal 41, an external client 42, and a load balancer 43. The deployment cluster terminal 41 and the external client 42 are respectively connected to the load balancer 43.
[0106] The deployment cluster 41 includes at least two deployment clusters 411, each of which has at least one deployment application deployed in it; the external client 42 is used to send external exposure requests and business traffic data to the load balancer 43.
[0107] Figure 7 This is a schematic diagram of a load balancer provided according to one embodiment of the present invention. The load balancer 43 is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. Electronic devices can also represent various forms of mobile devices, such as personal digital processors, cellular phones, smartphones, wearable devices (e.g., helmets, glasses, watches, etc.), and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely illustrative and are not intended to limit the implementation of the invention described and / or claimed herein.
[0108] like Figure 7 As shown, the load balancer 43 includes at least one processor 11 and a memory, such as a read-only memory (ROM) 12 or a random access memory (RAM) 13, communicatively connected to the at least one processor 11. The memory stores computer programs executable by the at least one processor 11. The processor 11 can perform various appropriate actions and processes based on the computer program stored in the ROM 12 or loaded from storage unit 18 into the RAM 13. The RAM 13 can also store various programs and data required for the operation of the load balancer 43. The processor 11, ROM 12, and RAM 13 are interconnected via a bus 14. An input / output (I / O) interface 15 is also connected to the bus 14.
[0109] Multiple components in the load balancer 43 are connected to the I / O interface 15, including: input units 16, such as a keyboard, mouse, etc.; output units 17, such as various types of displays, speakers, etc.; storage units 18, such as disks, optical disks, etc.; and communication units 19, such as network interface cards, modems, wireless transceivers, etc. The communication unit 19 allows the load balancer 43 to exchange information / data with other devices through computer networks such as the Internet and / or various telecommunications networks.
[0110] Processor 11 can be a variety of general-purpose and / or special-purpose processing components with processing and computing capabilities. Some examples of processor 11 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various special-purpose artificial intelligence (AI) computing chips, various processors running machine learning model algorithms, a digital signal processor (DSP), and any suitable processor, controller, microcontroller, etc. Processor 11 performs the various methods and processes described above, such as the externally exposed methods provided in the above embodiments.
[0111] In some embodiments, the external exposure method provided in the above embodiments can be implemented as a computer program tangibly contained in a computer-readable storage medium, such as storage unit 18. In some embodiments, part or all of the computer program can be loaded and / or installed on the load balancer 43 via ROM 12 and / or communication unit 19. When the computer program is loaded into RAM 13 and executed by processor 11, one or more steps of the external exposure method described above can be performed. Alternatively, in other embodiments, processor 11 can be configured to perform the external exposure method by any other suitable means (e.g., by means of firmware).
[0112] Various embodiments of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field-programmable gate arrays (FPGAs), application-specific integrated circuits (ASICs), application-specific standard products (ASSPs), systems-on-a-chip (SoCs), payload-programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various embodiments may include implementations in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which may be a dedicated or general-purpose programmable processor, capable of receiving data and instructions from a storage system, at least one input device, and at least one output device, and transmitting data and instructions to the storage system, the at least one input device, and the at least one output device.
[0113] Computer programs used to implement the methods of the present invention may be written in any combination of one or more programming languages. These computer programs may be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing device, such that when executed by the processor, the computer programs cause the functions / operations specified in the flowcharts and / or block diagrams to be performed. The computer programs may be executed entirely on a machine, partially on a machine, or as a standalone software package, partially on a machine and partially on a remote machine, or entirely on a remote machine or server.
[0114] In the context of this invention, a computer-readable storage medium can be a tangible medium that may contain or store a computer program for use by or in conjunction with an instruction execution system, apparatus, or device. A computer-readable storage medium may include, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination thereof. Alternatively, a computer-readable storage medium may be a machine-readable signal medium. More specific examples of machine-readable storage media include electrical connections based on one or more wires, portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fibers, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination thereof.
[0115] To provide interaction with a user, the systems and techniques described herein can be implemented on an electronic device having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and pointing device (e.g., a mouse or trackball) through which the user provides input to the electronic device. Other types of devices can also be used to provide interaction with the user; for example, feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including sound input, voice input, or tactile input).
[0116] The systems and technologies described herein can be implemented in computing systems that include backend components (e.g., as data servers), or computing systems that include middleware components (e.g., application servers), or computing systems that include frontend components (e.g., user computers with graphical user interfaces or web browsers through which users can interact with implementations of the systems and technologies described herein), or any combination of such backend, middleware, or frontend components. The components of the system can be interconnected via digital data communication of any form or medium (e.g., communication networks). Examples of communication networks include local area networks (LANs), wide area networks (WANs), blockchain networks, and the Internet.
[0117] A computing system can include clients and servers. Clients and servers are generally located far apart and typically interact through communication networks. The client-server relationship is created by computer programs running on the respective computers and having a client-server relationship with each other. The server can be a cloud server, also known as a cloud computing server or cloud host, which is a hosting product within the cloud computing service system to address the shortcomings of traditional physical hosts and VPS services, such as high management difficulty and weak business scalability.
[0118] It should be understood that the various forms of processes shown above can be used, with steps reordered, added, or deleted. For example, the steps described in this invention can be executed in parallel, sequentially, or in different orders, as long as the desired result of the technical solution of this invention can be achieved, and this is not limited herein.
[0119] The specific embodiments described above do not constitute a limitation on the scope of protection of this invention. Those skilled in the art should understand that various modifications, combinations, sub-combinations, and substitutions can be made according to design requirements and other factors. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of this invention should be included within the scope of protection of this invention.
Claims
1. A method for external exposure, characterized in that, include: In response to detecting the application identifier of the deployed application synchronized from the deployment cluster, obtain the node port addresses corresponding to at least two deployment clusters and the deployed application respectively in the deployment cluster. Store the application identifier, the load balancer and the load routing address corresponding to the deployed application, and the port address of each node; In response to detecting an external exposure request sent by an external client, the load routing address corresponding to the application identifier in the external exposure request is sent to the external client; In response to detecting that the external client sends service traffic data by accessing the load routing address, at least two node port addresses corresponding to the load routing address are obtained, and the service traffic data is sent to the application nodes of the deployment cluster corresponding to each of the node port addresses. The method further includes: obtaining the load port address corresponding to the application identifier of the deployed application; Based on the load balancer's load IP address and load port address, a load routing address corresponding to the load balancer and the deployed application is generated.
2. The method according to claim 1, characterized in that, Obtaining the node port addresses corresponding to at least two deployment clusters and the deployed application in the deployment cluster includes: Obtain the cluster interface addresses corresponding to at least two deployment clusters to which the deployed application belongs, synchronized from the deployment cluster terminal; For each cluster interface address, a query operation is performed on the set of exposed services in the deployment cluster corresponding to the cluster interface address, based on the application identifier; Based on the query result data received from the deployment cluster, the node port address corresponding to the deployment cluster and the deployment application is determined.
3. The method according to claim 2, characterized in that, The query result data includes the service application status of the deployed application. When the service application status in the query result data is "application completed", the query result data also includes the exposed service type applied for by the deployed application and the routing address corresponding to the exposed service type.
4. The method according to claim 3, characterized in that, The step of determining the node port address corresponding to the deployment cluster and the deployment application based on the received query result data sent by the deployment cluster includes: If the service application status in the query result data is "application submitted" and the exposed service type in the query result data is "NodePort", then the node port address corresponding to the deployment cluster and the deployment application is generated based on the cluster interface address and the routing address in the query result data.
5. The method according to claim 4, characterized in that, The step of determining the node port address corresponding to the deployment cluster and the deployment application based on the received query result data sent by the deployment cluster further includes: If the service application status in the query result data is "not applied", or if the exposed service type in the query result data is "ClusterIP", obtain the software development kit tool corresponding to the deployment cluster synchronized from the deployment cluster terminal; By invoking the software development kit tools, based on the application identifier, a NodePort type exposure service is requested from the exposure services in the deployment cluster; Based on the cluster interface address and the routing address received from the deployment cluster, the node port address corresponding to the deployment cluster and the deployment application is generated.
6. The method according to any one of claims 1-5, characterized in that, Sending the service traffic data to the application nodes of the deployment cluster corresponding to each of the node port addresses includes: Obtain the traffic allocation ratios corresponding to at least two deployment clusters to which the deployed application belongs; For each deployment cluster, the business traffic data is sent to the application node of the deployment cluster based on the node port address and traffic allocation ratio corresponding to the deployment cluster.
7. An externally exposed device, characterized in that, include: The node port address acquisition module is used to acquire the node port addresses corresponding to at least two deployment clusters and the deployment application, respectively, in response to detecting the application identifier of the deployment application synchronized from the deployment cluster end. The node port address storage module is used to store the application identifier, the load balancer and the load routing address corresponding to the deployed application, and the corresponding node port addresses. The load routing address sending module is used to send the load routing address corresponding to the application identifier in the external exposure request to the external client in response to the detection of an external client's external exposure request; The service traffic data sending module is used to respond to the detection that the external client sends service traffic data by accessing the load routing address, obtain at least two node port addresses corresponding to the load routing address, and send the service traffic data to the application nodes of the deployment cluster corresponding to each of the node port addresses respectively; The device further includes a load routing address generation module; The load routing address generation module is used to: obtain the load port address corresponding to the application identifier of the deployed application; and generate the load routing address corresponding to the load balancer and the deployed application based on the load IP address of the load balancer and the load port address.
8. A cluster deployment system, characterized in that, The cluster deployment system includes: a deployment cluster terminal, an external client, and a load balancer, wherein the deployment cluster terminal and the external client are respectively connected to the load balancer. The deployment cluster includes at least two deployment clusters, and each deployment cluster deploys at least one application. The external client is used to send external exposure requests and business traffic data to the load balancer; The load balancer includes: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores a computer program executable by the at least one processor, the computer program being executed by the at least one processor to enable the at least one processor to perform the external exposure method according to any one of claims 1-6.
9. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer instructions that cause a processor to execute the external exposure method according to any one of claims 1-6.
Citation Information
Patent Citations
Intra-city active-active system and method based on micro-service
CN112671882A
Network access method and device based on Kubernetes, equipment and medium
CN113572838A