CN115361440A - Updating method and updating device for endpoint resources of multiple Kubernetes clusters and electronic equipment - Google Patents

Updating method and updating device for endpoint resources of multiple Kubernetes clusters and electronic equipment Download PDF

Info

Publication number
CN115361440A
CN115361440A CN202210968475.4A CN202210968475A CN115361440A CN 115361440 A CN115361440 A CN 115361440A CN 202210968475 A CN202210968475 A CN 202210968475A CN 115361440 A CN115361440 A CN 115361440A
Authority
CN
China
Prior art keywords
service
endpoint
target
updating
change event
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.)
Pending
Application number
CN202210968475.4A
Other languages
Chinese (zh)
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.)
Sina Technology China Co Ltd
Original Assignee
Sina Technology China 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 Sina Technology China Co Ltd filed Critical Sina Technology China Co Ltd
Priority to CN202210968475.4A priority Critical patent/CN115361440A/en
Publication of CN115361440A publication Critical patent/CN115361440A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/10Protocols in which an application is distributed across nodes in the network

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Data Exchanges In Wide-Area Networks (AREA)

Abstract

The application discloses a method and a device for updating endpoint resources of multiple Kubernets clusters and electronic equipment, wherein the updating method comprises the following steps: monitoring change event information of a service endpoint corresponding to services in a multi-Kubernetes cluster, wherein the change event information indicates that the endpoint resource of the service endpoint corresponding to the services is changed; and updating the stored endpoint resources corresponding to the service according to the change event information, wherein the endpoint resources comprise address information, and the address information comprises a PodIP address and a weight value corresponding to the PodIP address.

Description

Updating method and updating device for endpoint resources of multiple Kubernets clusters and electronic equipment
Technical Field
The present application relates to the field of cluster information, and in particular, to a method and an apparatus for updating endpoint resources of multiple kubernets clusters, and an electronic device.
Background
In the Kubernetes (K8 s) cluster, pod is the basis for all traffic types, and each Pod is assigned a unique Internet Protocol (IP) address for interconnection between networks.
Under the environment of multiple kubernets, service (Service) deployment is often required in multiple clusters for business services, and a set of Ingress needs to be deployed on each kubernets cluster to access the internal application of the K8s in a domain name mode.
Disclosure of Invention
The application discloses an updating method and an updating device for endpoint resources of multiple Kubernets, and electronic equipment, and aims to solve the problem that data instantaneity is poor due to the fact that rear-end PodIP addresses corresponding to multiple clusters cannot be sensed in real time.
In order to solve the above problems, the following technical solutions are adopted in the present application:
in a first aspect, an embodiment of the present application provides an updating method for endpoint resources of multiple kubernets clusters, including: monitoring change event information of a service endpoint corresponding to services in a multi-Kubernetes cluster, wherein the change event information indicates that the endpoint resource of the service endpoint corresponding to the services is changed; and updating the stored endpoint resources corresponding to the service according to the change event information, wherein the endpoint resources comprise address information, and the address information comprises a PodIP address and a weight value corresponding to the PodIP address.
In a second aspect, an embodiment of the present application provides an apparatus for updating an endpoint resource of multiple kubernets clusters, including: the monitoring module is used for monitoring change event information of a service endpoint corresponding to services in a multi-Kubernetes cluster, wherein the change event information indicates that the endpoint resource of the service endpoint corresponding to the services is changed; and the updating module is used for updating the stored endpoint resources corresponding to the service according to the change event information, wherein the endpoint resources comprise address information, and the address information comprises a PodIP address and a weight value corresponding to the PodIP address.
In a third aspect, embodiments of the present application provide an electronic device, which includes a processor and a memory, where the memory stores a program or instructions executable on the processor, and the program or instructions, when executed by the processor, implement the steps of the method according to the first aspect.
In a fourth aspect, embodiments of the present application provide a readable storage medium, on which a program or instructions are stored, which when executed by a processor, implement the steps of the method according to the first aspect.
In a fifth aspect, an embodiment of the present application provides a chip, where the chip includes a processor and a communication interface, where the communication interface is coupled to the processor, and the processor is configured to execute a program or instructions to implement the method according to the first aspect.
In a sixth aspect, embodiments of the present application provide a computer program product, stored on a storage medium, for execution by at least one processor to implement the method according to the first aspect.
The embodiment of the application provides an updating method of endpoint resources of a multi-Kubernets cluster, which is characterized in that change event information indicating that the endpoint resources of service endpoints corresponding to services in the multi-Kubernets cluster are changed is monitored, and the stored endpoint resources corresponding to the services are updated according to the change event information, wherein the endpoint resources comprise PodIP addresses and weighted values corresponding to the PodIP addresses, so that rear-end PodIP addresses corresponding to the multi-clusters can be sensed in real time, and the real-time performance of data is further ensured.
Drawings
Fig. 1 is a schematic flowchart of a method for updating endpoint resources of multiple kubernets clusters disclosed in an embodiment of the present application;
fig. 2 is a flowchart of an updating method of an endpoint resource of a multi-kubernets cluster disclosed in an embodiment of the present application;
FIG. 3 is a diagram illustrating a shared memory data structure according to an embodiment of the present disclosure;
fig. 4 is a flowchart of an updating method of an endpoint resource of a multi-kubernets cluster disclosed in an embodiment of the present application;
fig. 5 is a schematic structural diagram of an apparatus for updating endpoint resources of multiple kubernets clusters disclosed in an embodiment of the present application;
fig. 6 is a schematic structural diagram of an electronic device disclosed in an embodiment of the present application.
Detailed Description
The technical solutions in the embodiments of the present application will be described clearly below with reference to the drawings in the embodiments of the present application, and it is obvious that the described embodiments are some, but not all, embodiments of the present application. All other embodiments that can be derived by one of ordinary skill in the art from the embodiments given herein are intended to be within the scope of the present disclosure.
The terms first, second and the like in the description and in the claims of the present application are used for distinguishing between similar elements and not necessarily for describing a particular sequential or chronological order. It will be appreciated that the data so used may be interchanged under appropriate circumstances such that embodiments of the application are capable of operation in sequences other than those illustrated or described herein, and that the terms "first," "second," etc. are generally used in a generic sense and do not limit the number of terms, e.g., a first term can be one or more than one. In addition, "and/or" in the specification and claims means at least one of connected objects, a character "/" generally means that a preceding and succeeding related objects are in an "or" relationship.
The method, the apparatus, and the electronic device for updating endpoint resources of multiple kubernets clusters provided in the embodiments of the present application are described in detail below with reference to the accompanying drawings.
An embodiment of the present application provides a method for updating endpoint resources of multiple kubernets, and fig. 1 is a schematic flow diagram of the method for updating endpoint resources of multiple kubernets disclosed in the embodiment of the present application. As shown in fig. 1, the method includes the following steps.
S120, monitoring change event information of a service endpoint corresponding to the service in the multi-Kubernetes cluster, wherein the change event information indicates that the endpoint resource of the service endpoint corresponding to the service is changed.
In the application, the PodIP aware service monitors change event information of a service endpoint corresponding to a service in a multi-kubernets cluster, where the change event information may include a change event type and a name space service name corresponding to the service. The changing event type may include adding an endpoint resource, modifying an endpoint resource, and deleting an endpoint resource, and in the case that the changing event type is adding an endpoint resource or modifying an endpoint resource, the changing event information may further include address information corresponding to a target endpoint resource to be changed.
In one implementation, the change event information of the service endpoint corresponding to the service in the multiple kubernets cluster may be sent by a target kubernets cluster in the multiple kubernets cluster, and the PodIP aware service instructs to change the endpoint resource of the service endpoint according to the monitored change event information of the service endpoint corresponding to the service sent by the target kubernets cluster in the multiple kubernets cluster.
It should be noted that the target kubernets cluster may be one kubernets cluster among multiple kubernets clusters, or several kubernets clusters among multiple kubernets clusters, which is not specifically limited in this application.
In one implementation, the change event information of the service Endpoint (Endpoint) corresponding to the service in the multi-kubernets cluster may be monitored by the multi-cluster event collector shown in fig. 2, mainly using a kubernetesesindermer mechanism.
And S140, updating the stored endpoint resource corresponding to the service according to the change event information, wherein the endpoint resource comprises address information, and the address information comprises a PodIP address and a weight value corresponding to the PodIP address.
That is to say, the PodIP aware service changes the stored endpoint resource corresponding to the service according to the monitored change event information of the service endpoint corresponding to the service in the multi-kubernets cluster, and stores the changed endpoint resource in the shared memory. Illustratively, the PodIP address in the endpoint resource corresponding to the service may be changed according to the change event information.
The embodiment of the application provides an updating method of endpoint resources of a multi-Kubernets cluster, which is characterized in that change event information indicating that the endpoint resources of service endpoints corresponding to services in the multi-Kubernets cluster are changed is monitored, and the stored endpoint resources corresponding to the services are updated according to the change event information, wherein the endpoint resources comprise PodIP addresses and weighted values corresponding to the PodIP addresses, so that rear-end PodIP addresses corresponding to the multi-clusters can be sensed in real time, and the real-time performance of data is further ensured.
In this embodiment of the application, the updating, according to the change event information, the endpoint resource corresponding to the stored service may include: acquiring the change event information, wherein the change event information comprises: changing the event type and the name space service name corresponding to the service; generating an event message to be processed according to the change event information, and storing the event message to a speed limit message queue, wherein the event message comprises: changing the event type, changing identification information of a target Kubernets cluster where the event occurs, and a name space service name corresponding to the service; and acquiring the event message to be processed from the speed limit message queue, and updating the stored endpoint resource corresponding to the service according to the event message, wherein the endpoint resource corresponding to the service is stored in a shared memory according to a preset format, and the preset format is used for establishing the corresponding relation between the name space service name corresponding to the service and the endpoint resource corresponding to the service.
Under the condition that change event information of service endpoints corresponding to services in a plurality of Kubernets clusters is monitored, change event information comprising change event types and name space service names corresponding to the services can be acquired, because the change event information does not comprise identification information of a target Kubernets cluster in which the change event occurs, identification information of the target Kubernets cluster in which the change event occurs needs to be acquired, the event information comprising the change event types, the identification information of the target Kubernets cluster in which the change event occurs and the name space service names corresponding to the services to be processed is generated according to the change event information and the identification information of the target Kubernets cluster in which the change event occurs, the event information to be processed is stored in a speed limit message queue shown in figure 2, certain speed limit is carried out on the event information through the speed limit message queue, then a coordinator shown in figure 2 acquires the event information to be processed from the speed limit message queue, and updates and stores the stored endpoint resources corresponding to the services in a shared memory according to the event information. According to the method and the device, the event message is stored in the speed-limiting message queue, and the speed-limiting message queue carries out certain speed limitation on the event message, so that the coordinator can be protected, and the coordinator is prevented from frequently coordinating resources.
In this application, the identification information of the target kubernets cluster may include a cluster name of the target kubernets cluster and cluster ID information of the target kubernets cluster.
In this embodiment of the present application, in a case that a change event type of the change event information is that an endpoint resource is added, the change event information may further include address information corresponding to a target endpoint resource to be added, and the event message may further include address information corresponding to the target endpoint resource to be added; the updating the endpoint resource corresponding to the stored service according to the event message may include: generating the target endpoint resource to be added according to a preset format, wherein the target endpoint resource comprises: the identification information of the target Kubernets cluster and the address information corresponding to the target endpoint resource; and adding the target endpoint resource in the stored endpoint resources corresponding to the service.
When the change event type of the change event information of the service endpoint corresponding to the service in the multiple kubernets cluster is to increase an endpoint resource, the obtained change event information further includes address information corresponding to a target endpoint resource to be increased, and correspondingly, the generated event message to be processed further includes address information corresponding to the target endpoint resource to be increased, the target endpoint resource to be increased is generated according to a predetermined format, then the service is determined from the shared memory storage according to the name space service name corresponding to the service, and the target endpoint resource is added to the stored endpoint resource corresponding to the service, wherein the target endpoint resource includes identification information of the target kubernets cluster and address information corresponding to the target endpoint resource, the identification information of the target kubernets cluster may include a netcluster name (clusterName) of the target kubernets cluster and cluster ID information (clusterId) of the target kubernets cluster, and the address information (addresses) corresponding to the target endpoint resource may include a PodIP address, port information of the service, and a weighted value corresponding to the PodIP address. For example, the predetermined format may be: { cluster ID, cluster name, address information (PodIP, port (port), weight value (weight) corresponding to PodIP)) }.
For example, when change event information of a service endpoint corresponding to a service in multiple kubernets cluster is monitored and the change event information is a change event type sent by kubernets cluster a and is an added endpoint resource, the change event information and the event message further include address information ("ip": 10.210.10.163"," port ": 8080", "weight": 100) corresponding to the target endpoint resource to be added, where the identification information of kubernets cluster a is: in the case of "clusterId", "c _25626371485k", "clusterinanme": kubernets Cluster a ", a target endpoint resource to be added is generated according to a predetermined format, and may be {" clusterId ": c _25626371485k", "clusterimname": kubernets Cluster a "," addresses ": {" ip ": 10.210.10.163", "port":8080 "," weight ":100} ], and then a service is determined from the shared memory storage according to a name space service name corresponding to the service, and the target endpoint resource is added to the endpoint resource corresponding to the stored service.
When processing an event of increasing endpoint resources, a data structure such as a thread safety dictionary is needed to be used to ensure thread safety during data storage, wherein keys of the thread safety dictionary are: "namespace service name" with a value of: a list with Clusters (Clusters) (003 as shown in fig. 3) as a data structure.
In this embodiment of the present application, in a case that a change event type of the change event information is a modification endpoint resource, the change event information further includes address information corresponding to a target endpoint resource to be modified, and the event message further includes address information corresponding to the target endpoint resource to be modified; the updating the endpoint resource corresponding to the stored service according to the event message may include: generating target endpoint resources to be modified according to a preset format, wherein the target endpoint resources comprise: the identification information of the target Kubernetes cluster and the address information corresponding to the target endpoint resource; replacing initial endpoint resources by the target endpoint resources, wherein the initial endpoint resources are stored endpoint resources corresponding to the identification information of the target Kubernets cluster in the endpoint resources corresponding to the service.
When the change event type of the change event information of the service endpoint corresponding to the service in the multiple kubernets cluster is a modification endpoint resource, the obtained change event information further includes address information corresponding to a target endpoint resource to be modified, correspondingly, the generated event message to be processed further includes address information corresponding to the target endpoint resource to be modified, the target endpoint resource to be modified is generated according to a predetermined format, then, the service is determined from a shared memory storage according to a name space service name corresponding to the service, and a cluster (Clusters) in a loop (shown in fig. 3) is circulated, if the cluster identification information is the same as a cluster identification of a cluster occurring in the current change event, the endpoint resource corresponding to the identification information of the target kubernets in the stored endpoint resources corresponding to the service is replaced by the target endpoint resource, wherein the target endpoint resource includes identification information of the target kubernets and address information corresponding to the target endpoint resource, and the identification information of the target kubernets of the kubernets may include a cluster name (cluster) of the target kubernets of the kubernets and address information corresponding to target endpoint resources ID (corresponding to the kubernets), and the target kubernets information may include address information of the target address corresponding to the kubernets ID (ip cluster resource ID) of the kubernets. For example, the predetermined format may be: { cluster ID, cluster name, address information (PodIP, port (port), weight value (weight) corresponding to PodIP)) }.
Illustratively, the PodIP in the endpoint resource of the kubernets cluster a (i.e., the target kubernets cluster) in the endpoint resource corresponding to the native service is 10.210.10.164, and the change event information sent by the kubernets cluster a is to modify the PodIP in the endpoint resource of the kubernets cluster a to 10.210.10.163, and then the change event information and the event message further include address information ("ip": 10.210.10.163"," port ": 8080", "weight": 100) corresponding to the target endpoint resource to be modified, respectively, and the identification information in the kubernets cluster a is: "clusterId": and in the case of 'c _25626371485 k', 'clusterName': kubernets Cluster A ', a target endpoint resource to be modified is generated according to a predetermined format, and the target endpoint resource to be modified can be {' clusterId ': C _25626371485 k', 'clusterName': kubernets A ',' addresses '{' ip ': 10.210.10.163', 'port': 8080 ',' weight ': 100}, then a service is determined according to a name space service name corresponding to the service, and the generated target endpoint resource to be modified replaces the initial endpoint resource {' clusterId ': C _ 25626375 k', 'clusterName': kurades Cluster A 'and' 10 {: 10.80 {: 10.10.80 } of the endpoint resource corresponding to the Kuberets Cluster A } in the endpoint resource corresponding to the service.
In this embodiment of the present application, the updating, according to the event message, the endpoint resource corresponding to the stored service may include: under the condition that the change event type of the change event information is the deletion of the endpoint resource, searching a target endpoint resource to be deleted according to the name space service name and the identification information of the target Kubernetes cluster; and deleting the target endpoint resource from the stored endpoint resources corresponding to the service, so as to achieve the purpose of deleting the data stored in the shared memory.
For example, the endpoint resource corresponding to the originally stored service includes an endpoint resource of a kubernets cluster a and an endpoint resource of a kubernets cluster B, and when change event information sent by the kubernets cluster B is monitored and the event type of the change event information is deletion of the endpoint resource of the kubernets cluster B, the service is determined from the shared memory storage according to the name space service name, the endpoint resource of the kubernets cluster B is determined in the service according to the identification information of the kubernets cluster B, and the endpoint resource of the kubernets cluster B is deleted in the endpoint resource corresponding to the stored service.
In the present application, as shown in fig. 2, data coordinated by the coordinator is stored in the shared memory, and in order to ensure the writing and reading speed of the data, a memory storage manner is adopted. And meanwhile, the shared memory is stored as a data source of the Web service and is provided for the data source related to the Web service. A shared memory storage data structure is shown in fig. 3, where the data structure uses a dictionary-based data structure, and the purpose of using the data structure of a dictionary is to quickly search and delete a value in a modified dictionary.
As shown in fig. 2, the Web service provides an Application Programming Interface (API) of a HyperText Transfer Protocol (HTTP), and obtains a backend PodIP address list corresponding to the multiple cluster services from the shared memory storage through the HTTP API Interface and an HTTP query parameter (name space service name). Since the shared storage is stored in the memory, the response speed of the Web server is very fast.
The data format obtained from the shared memory storage may be a YAML data format, and in the case that the shared memory storage stores the endpoint resource of the kubernets cluster a and the endpoint resource of the kubernets cluster B, for example, the obtained data may be: "{" clusterId "": c _25626371485k "," clusterimname ": kubernets Cluster A", "addresses": { "ip": 10.210.10.163"," port ": 8080", "weight":100// PodIP }, { "ip": 10.210.10.164"," port ": 8080", "weight":100} ] }, { "clusterId": c _ 27169024I "," clusterinanme ": kubersets Cluster B", "addresses": 10.210.170.100"," port ": 8080", "weight": 643 } ] } ].
In one implementation, the monitored change event information of the service endpoint corresponding to the service in the multi-kubernets cluster includes an event type, a namespace service name and a PodIP address corresponding to the service, and a weight value corresponding to the PodIP address is not included, and the coordinator gives an initial weight value, which may be 100, for example. After the updating the endpoint resource corresponding to the stored service according to the change event information, the method may further include: receiving a name space service name, a PodIP address and a target weight value corresponding to the PodIP address, wherein the name space service name and the PodIP address correspond to the service and are input from the outside; determining an initial weight value corresponding to the PodIP address in an endpoint resource corresponding to the service according to the name space service name and the PodIP address; modifying the initial weight value to the target weight value. That is, the user may modify the weight value corresponding to the PodIP address, for example, receive an externally input namespace service name corresponding to the service, the PodIP address 10.210.10.163, and a target weight value M corresponding to the PodIP address, and the Web service determines an initial weight value 100 corresponding to the PodIP address according to the namespace service name and the PodIP address 10.210.10.163, and then modifies 100 to M.
In the present application, as shown in fig. 4, a multi-kubernets cluster service may directly deploy a central-level seven-layer reverse proxy, and the seven-layer reverse proxy may obtain backend PodIP information by calling an HTTP API interface, and may distribute traffic to a backend Pod. In addition, in the present application, the endpoint resources of the service endpoint corresponding to the service in the multiple kubernets cluster include the endpoint resources of the multiple kubernets cluster, and the endpoint resources corresponding to the service are updated in real time, so that cross-cluster traffic scheduling can be implemented.
And through the Web service, the data stored in the shared memory can be directly modified, the weight of the rear-end Pod IP is modified, and through the modification of the weight, the seven-layer reverse proxy service can perform operations such as multi-cluster switching of service flow, canary publishing of multi-cluster flow, gray publishing of multi-cluster flow and the like.
The embodiment of the application provides an updating method of endpoint resources of a multi-Kubernetes cluster, which comprises the steps of monitoring change event information of a service endpoint corresponding to a service in the multi-Kubernetes cluster, acquiring the change event information, generating an event message to be processed according to the change event information, and storing the event message in a speed limit message queue, wherein the event message comprises identification information of a target Kubernetes cluster in which a change event occurs, a name space service name corresponding to the service and a change event type; under the condition that the event type is changed to increase the endpoint resources, the event message also comprises address information corresponding to the target endpoint resources to be increased, and the target endpoint resources to be increased are generated according to a preset format, wherein the target endpoint resources comprise: the identification information of the target Kubernetes cluster and the address information corresponding to the target endpoint resources are added with the target endpoint resources in the stored endpoint resources corresponding to the service; under the condition that the change event type is the modification of the endpoint resources, the event message also comprises address information corresponding to the target endpoint resources to be modified, and the target endpoint resources to be modified are generated according to a preset format, wherein the target endpoint resources comprise: and replacing the initial endpoint resource by the target endpoint resource according to the identification information of the target Kubernets cluster and the address information corresponding to the target endpoint resource, wherein the initial endpoint resource is the endpoint resource corresponding to the identification information of the target Kubernets cluster in the endpoint resource corresponding to the stored service.
In the method for updating an endpoint resource of a multi-kubernets cluster provided in the embodiment of the present application, the execution main body may be an updating apparatus for an endpoint resource of a multi-kubernets cluster. In the embodiment of the present application, an example in which an updating apparatus for an endpoint resource of a multi-kubernets cluster executes an updating method for an endpoint resource of a multi-kubernets cluster is taken as an example, and the updating apparatus for an endpoint resource of a multi-kubernets cluster provided in the embodiment of the present application is described.
Fig. 5 is a schematic structural diagram of an apparatus for updating endpoint resources of multiple kubernets clusters disclosed in an embodiment of the present application. As shown in fig. 5, the apparatus 500 for updating endpoint resources of multiple kubernets clusters includes: a listening module 510 and an updating module 520.
In this application, the monitoring module 510 is configured to monitor change event information of a service endpoint corresponding to a service in multiple kubernets clusters, where the change event information indicates that an endpoint resource of the service endpoint corresponding to the service is changed; an updating module 520, configured to update, according to the change event information, an endpoint resource corresponding to the stored service, where the endpoint resource includes address information, and the address information includes a PodIP address and a weight value corresponding to the PodIP address.
In one implementation, the updating module 520 updates the stored endpoint resource corresponding to the service according to the change event information, including: acquiring the change event information, wherein the change event information comprises: changing the event type and the name space service name corresponding to the service; generating an event message to be processed according to the change event information, and storing the event message to a speed limit message queue, wherein the event message comprises: changing the event type, changing identification information of a target Kubernets cluster where the event occurs, and a name space service name corresponding to the service; and acquiring the event message to be processed from the speed limit message queue, and updating the stored endpoint resource corresponding to the service according to the event message, wherein the endpoint resource corresponding to the service is stored in a shared memory according to a preset format, and the preset format is used for establishing the corresponding relation between the name space service name corresponding to the service and the endpoint resource corresponding to the service.
In one implementation manner, in a case that a change event type of the change event information is that an endpoint resource is added, the change event information further includes address information corresponding to a target endpoint resource to be added, and the event message further includes address information corresponding to the target endpoint resource to be added; the updating module 520 updates the stored endpoint resource corresponding to the service according to the event message, including: generating the target endpoint resource to be added according to a preset format, wherein the target endpoint resource comprises: the identification information of the target Kubernetes cluster and the address information corresponding to the target endpoint resource; and adding the target endpoint resource in the stored endpoint resources corresponding to the service.
In one implementation manner, when a change event type of the change event information is to modify an endpoint resource, the change event information further includes address information corresponding to a target endpoint resource to be modified, and the event message further includes address information corresponding to the target endpoint resource to be modified; the updating module 520 updates the stored endpoint resource corresponding to the service according to the event message, including: generating the target endpoint resource to be modified according to a preset format, wherein the target endpoint resource comprises: the identification information of the target Kubernets cluster and the address information corresponding to the target endpoint resource; replacing an initial endpoint resource by the target endpoint resource, wherein the initial endpoint resource is an endpoint resource corresponding to the identification information of the target Kubernets cluster in the stored endpoint resources corresponding to the service.
In one implementation, the updating module 520 updates the stored endpoint resource corresponding to the service according to the event message, including: under the condition that the change event type of the change event information is the deletion of the endpoint resource, searching a target endpoint resource to be deleted according to the name space service name and the identification information of the target Kubernetes cluster; and deleting the target endpoint resource from the stored endpoint resources corresponding to the service.
In one implementation, the updating apparatus further includes: a receiving module, configured to receive a namespace service name, a PodIP address, and a target weight value corresponding to the PodIP address, which are input from the outside, after the endpoint resource corresponding to the stored service is updated according to the change event information; a determining module, configured to determine, according to the name space service name and the PodIP address, an initial weight value corresponding to the PodIP address in an endpoint resource corresponding to the service; a modification module for modifying the initial weight value to the target weight value.
The updating apparatus for the endpoint resource of multiple kubernets clusters in this embodiment may be an electronic device, or may be a component in the electronic device, such as an integrated circuit or a chip. The electronic device may be a terminal, or may be a device other than a terminal.
The device for updating endpoint resources of multiple kubernets clusters provided in the embodiment of the present application can implement each process implemented by the method for updating endpoint resources of multiple kubernets clusters, and is not described herein again to avoid repetition.
Optionally, as shown in fig. 6, an electronic device 600 is further provided in an embodiment of the present application, and includes a processor 601 and a memory 602, where a program or an instruction that can be executed on the processor 601 is stored in the memory 602, and when the program or the instruction is executed by the processor 601, the steps of the embodiment of the method for updating endpoint resources of multiple kubernets cluster are implemented, and the same technical effect can be achieved, and details are not repeated here to avoid repetition.
It should be noted that the electronic device in the embodiment of the present application includes the mobile electronic device and the non-mobile electronic device described above.
The embodiment of the present application further provides a readable storage medium, where a program or an instruction is stored on the readable storage medium, and when the program or the instruction is executed by a processor, the program or the instruction implements each process of the above-mentioned embodiment of the method for updating endpoint resources of multiple kubernets cluster, and can achieve the same technical effect, and in order to avoid repetition, details are not described here again.
The processor is the processor in the electronic device described in the above embodiment. The readable storage medium includes a computer readable storage medium, such as a computer read only memory ROM, a random access memory RAM, a magnetic or optical disk, and the like.
The embodiment of the present application further provides a chip, where the chip includes a processor and a communication interface, the communication interface is coupled to the processor, and the processor is configured to execute a program or an instruction to implement each process of the embodiment of the method for updating endpoint resources of multiple kubernets cluster, and the same technical effect can be achieved.
It should be understood that the chips mentioned in the embodiments of the present application may also be referred to as a system-on-chip, or a system-on-chip.
Embodiments of the present application provide a computer program product, where the program product is stored in a storage medium, and the program product is executed by at least one processor to implement each process of the above embodiment of the method for updating endpoint resources of multiple kubernets cluster, and can achieve the same technical effect, and in order to avoid repetition, details are not described here again.
It should be noted that, in this document, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrases "comprising a component of' 8230; \8230;" does not exclude the presence of another like element in a process, method, article, or apparatus that comprises the element. Further, it should be noted that the scope of the methods and apparatus of the embodiments of the present application is not limited to performing the functions in the order illustrated or discussed, but may include performing the functions in a substantially simultaneous manner or in a reverse order based on the functions involved, e.g., the methods described may be performed in an order different than that described, and various steps may be added, omitted, or combined. In addition, features described with reference to certain examples may be combined in other examples.
Through the above description of the embodiments, those skilled in the art will clearly understand that the method of the above embodiments can be implemented by software plus a necessary general hardware platform, and certainly can also be implemented by hardware, but in many cases, the former is a better implementation manner. Based on such understanding, the technical solutions of the present application may be embodied in the form of a computer software product, which is stored in a storage medium (such as ROM/RAM, magnetic disk, optical disk) and includes instructions for enabling a terminal (such as a mobile phone, a computer, a server, or a network device) to execute the method according to the embodiments of the present application.
While the present embodiments have been described with reference to the accompanying drawings, it is to be understood that the invention is not limited to the precise embodiments described above, which are meant to be illustrative and not restrictive, and that various changes may be made therein by those skilled in the art without departing from the spirit and scope of the invention as defined by the appended claims.

Claims (10)

1. A method for updating endpoint resources of a plurality of Kubernets clusters is characterized by comprising the following steps:
monitoring change event information of service endpoints corresponding to services in a plurality of Kubernets, wherein the change event information indicates that endpoint resources of the service endpoints corresponding to the services are changed;
and updating the stored endpoint resources corresponding to the service according to the change event information, wherein the endpoint resources comprise address information, and the address information comprises a PodIP address and a weight value corresponding to the PodIP address.
2. The updating method according to claim 1, wherein the updating the endpoint resource corresponding to the stored service according to the change event information includes:
acquiring the change event information, wherein the change event information comprises: changing the event type and the name space service name corresponding to the service;
generating an event message to be processed according to the change event information, and storing the event message to a speed limit message queue, wherein the event message comprises: changing the event type, changing the identification information of a target Kubernetes cluster in which the event occurs, and changing the name space service name corresponding to the service;
and acquiring the event message to be processed from the speed limit message queue, and updating the stored endpoint resource corresponding to the service according to the event message, wherein the endpoint resource corresponding to the service is stored in a shared memory according to a preset format, and the preset format is used for establishing the corresponding relation between the name space service name corresponding to the service and the endpoint resource corresponding to the service.
3. The updating method according to claim 2, wherein in a case that a change event type of the change event information is an addition of an endpoint resource, the change event information further includes address information corresponding to a target endpoint resource to be added, and the event message further includes address information corresponding to the target endpoint resource to be added;
the updating the endpoint resource corresponding to the stored service according to the event message includes:
generating the target endpoint resource to be added according to a preset format, wherein the target endpoint resource comprises: the identification information of the target Kubernets cluster and the address information corresponding to the target endpoint resource;
and adding the target endpoint resource in the stored endpoint resources corresponding to the service.
4. The updating method according to claim 2, wherein in a case that a change event type of the change event information is to modify an endpoint resource, the change event information further includes address information corresponding to a target endpoint resource to be modified, and the event message further includes address information corresponding to the target endpoint resource to be modified;
the updating the endpoint resource corresponding to the stored service according to the event message includes:
generating the target endpoint resource to be modified according to a preset format, wherein the target endpoint resource comprises: the identification information of the target Kubernets cluster and the address information corresponding to the target endpoint resource;
replacing an initial endpoint resource by the target endpoint resource, wherein the initial endpoint resource is an endpoint resource corresponding to the identification information of the target Kubernets cluster in the stored endpoint resources corresponding to the service.
5. The updating method according to claim 2, wherein the updating the endpoint resource corresponding to the stored service according to the event message includes:
under the condition that the change event type of the change event information is the deletion of the endpoint resource, searching a target endpoint resource to be deleted according to the name space service name and the identification information of the target Kubernetes cluster;
and deleting the target endpoint resource from the stored endpoint resources corresponding to the service.
6. The updating method according to claim 2, further comprising, after the updating the endpoint resource corresponding to the stored service according to the change event information, the step of:
receiving a name space service name, a PodIP address and a target weight value corresponding to the PodIP address, wherein the name space service name and the PodIP address correspond to the service and are input from the outside;
determining an initial weight value corresponding to the PodIP address in an endpoint resource corresponding to the service according to the name space service name and the PodIP address;
modifying the initial weight value to the target weight value.
7. An apparatus for updating endpoint resources of a multi-kubernets cluster, comprising:
the monitoring module is used for monitoring change event information of a service endpoint corresponding to services in a plurality of Kubernets, wherein the change event information indicates that the endpoint resource of the service endpoint corresponding to the services is changed;
and the updating module is used for updating the stored endpoint resources corresponding to the service according to the change event information, wherein the endpoint resources comprise address information, and the address information comprises a PodIP address and a weight value corresponding to the PodIP address.
8. The updating apparatus according to claim 7, wherein the updating module updates the endpoint resource corresponding to the stored service according to the change event information, and includes:
acquiring the change event information, wherein the change event information comprises: changing the event type and the name space service name corresponding to the service;
generating an event message to be processed according to the change event information, and storing the event message to a speed limit message queue, wherein the event message comprises: changing the event type, changing the identification information of a target Kubernetes cluster in which the event occurs, and changing the name space service name corresponding to the service;
and acquiring the event message to be processed from the speed limit message queue, and updating the stored endpoint resource corresponding to the service according to the event message, wherein the endpoint resource corresponding to the service is stored in a shared memory according to a preset format, and the preset format is used for establishing the corresponding relation between the name space service name corresponding to the service and the endpoint resource corresponding to the service.
9. An electronic device comprising a processor and a memory, the memory storing a program or instructions executable on the processor, the program or instructions when executed by the processor implementing the steps of the method of updating endpoint resources of a multi-kubernets cluster of any of claims 1-6.
10. A readable storage medium, on which a program or instructions are stored, which program or instructions, when executed by a processor, carry out the steps of the method of updating endpoint resources of a plurality of kubernets clusters as claimed in any one of claims 1-6.
CN202210968475.4A 2022-08-12 2022-08-12 Updating method and updating device for endpoint resources of multiple Kubernetes clusters and electronic equipment Pending CN115361440A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210968475.4A CN115361440A (en) 2022-08-12 2022-08-12 Updating method and updating device for endpoint resources of multiple Kubernetes clusters and electronic equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210968475.4A CN115361440A (en) 2022-08-12 2022-08-12 Updating method and updating device for endpoint resources of multiple Kubernetes clusters and electronic equipment

Publications (1)

Publication Number Publication Date
CN115361440A true CN115361440A (en) 2022-11-18

Family

ID=84033254

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210968475.4A Pending CN115361440A (en) 2022-08-12 2022-08-12 Updating method and updating device for endpoint resources of multiple Kubernetes clusters and electronic equipment

Country Status (1)

Country Link
CN (1) CN115361440A (en)

Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112104486A (en) * 2020-08-31 2020-12-18 中国—东盟信息港股份有限公司 Kubernetes container-based network endpoint slicing method and system
CN112153143A (en) * 2020-09-24 2020-12-29 新浪网技术(中国)有限公司 Kubernetes cluster flow scheduling method and device and electronic equipment
CN113037881A (en) * 2021-02-05 2021-06-25 中国—东盟信息港股份有限公司 Cloud native service uninterrupted IP replacement method based on Kubernetes
CN113867955A (en) * 2021-09-27 2021-12-31 浪潮电子信息产业股份有限公司 Service discovery method, device, equipment and storage medium
CN114064206A (en) * 2021-11-05 2022-02-18 郑州云海信息技术有限公司 Pod method, system, equipment and storage medium for accessing edge node
CN114296909A (en) * 2021-12-02 2022-04-08 新浪网技术(中国)有限公司 Automatic node capacity expansion and reduction method and system according to kubernets event
CN114416200A (en) * 2022-01-11 2022-04-29 浪潮云信息技术股份公司 System and method for monitoring, acquiring, configuring and dynamically managing and loading configuration of declarative cloud platform

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112104486A (en) * 2020-08-31 2020-12-18 中国—东盟信息港股份有限公司 Kubernetes container-based network endpoint slicing method and system
CN112153143A (en) * 2020-09-24 2020-12-29 新浪网技术(中国)有限公司 Kubernetes cluster flow scheduling method and device and electronic equipment
CN113037881A (en) * 2021-02-05 2021-06-25 中国—东盟信息港股份有限公司 Cloud native service uninterrupted IP replacement method based on Kubernetes
CN113867955A (en) * 2021-09-27 2021-12-31 浪潮电子信息产业股份有限公司 Service discovery method, device, equipment and storage medium
CN114064206A (en) * 2021-11-05 2022-02-18 郑州云海信息技术有限公司 Pod method, system, equipment and storage medium for accessing edge node
CN114296909A (en) * 2021-12-02 2022-04-08 新浪网技术(中国)有限公司 Automatic node capacity expansion and reduction method and system according to kubernets event
CN114416200A (en) * 2022-01-11 2022-04-29 浪潮云信息技术股份公司 System and method for monitoring, acquiring, configuring and dynamically managing and loading configuration of declarative cloud platform

Similar Documents

Publication Publication Date Title
CN109582684B (en) Local cache data updating method and device, server and storage medium
CN111399756B (en) Data storage method, data downloading method and device
CN109618176B (en) Processing method, equipment and storage medium for live broadcast service
CN110377431B (en) Service calling method and device under multi-registry scene
CN108427619B (en) Log management method and device, computing equipment and storage medium
CN113141405B (en) Service access method, middleware system, electronic device, and storage medium
CN112565406B (en) Gray release method, gray release system and electronic equipment
CN111817984B (en) Message sending method, device, equipment and storage medium
US20220312309A1 (en) Method and Apparatus for Reporting User Plane Function Information, Storage Medium, and Electronic Apparatus
CN113268308B (en) Information processing method, device and storage medium
CN114756306A (en) Service calling method, device, equipment and storage medium
CN111901157A (en) Service deployment method, device, equipment and medium based on k8s
US10938773B2 (en) Method and apparatus for synchronizing contact information and medium
CN112579319A (en) Service calling method and device based on LRU Cache optimization
EP3974960A1 (en) Method and system for automated testing of web service apis
CN114328097A (en) File monitoring method and device, electronic equipment and storage medium
CN108111630B (en) Zookeeper cluster system and connection method and system thereof
CN110929195B (en) Data caching strategy determining method and device and electronic equipment
CN112751935A (en) Request processing method and device, electronic equipment and storage medium
CN115023919A (en) Firewall rule updating method and device, server and storage medium
CN115361440A (en) Updating method and updating device for endpoint resources of multiple Kubernetes clusters and electronic equipment
CN112019689A (en) Incoming call show service processing system and method
CN113360348B (en) Abnormal request processing method and device, electronic equipment and storage medium
CN111193805B (en) Resource discovery method and device
CN116028196A (en) Data processing method, device and storage medium

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
TA01 Transfer of patent application right

Effective date of registration: 20230313

Address after: Room 501-502, 5/F, Sina Headquarters Scientific Research Building, Block N-1 and N-2, Zhongguancun Software Park, Dongbei Wangxi Road, Haidian District, Beijing, 100193

Applicant after: Sina Technology (China) Co.,Ltd.

Address before: 100193 7th floor, scientific research building, Sina headquarters, plot n-1, n-2, Zhongguancun Software Park, Dongbei Wangxi Road, Haidian District, Beijing, 100193

Applicant before: Sina.com Technology (China) Co.,Ltd.

TA01 Transfer of patent application right