CN114448895B - Application access method, device, equipment and medium - Google Patents

Application access method, device, equipment and medium Download PDF

Info

Publication number
CN114448895B
CN114448895B CN202210371384.2A CN202210371384A CN114448895B CN 114448895 B CN114448895 B CN 114448895B CN 202210371384 A CN202210371384 A CN 202210371384A CN 114448895 B CN114448895 B CN 114448895B
Authority
CN
China
Prior art keywords
pod
information
request
endpoint
preset
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.)
Active
Application number
CN202210371384.2A
Other languages
Chinese (zh)
Other versions
CN114448895A (en
Inventor
黄吉旺
吴栋
王玉东
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Suzhou Inspur Intelligent Technology Co Ltd
Original Assignee
Suzhou Inspur Intelligent Technology 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 Suzhou Inspur Intelligent Technology Co Ltd filed Critical Suzhou Inspur Intelligent Technology Co Ltd
Priority to CN202210371384.2A priority Critical patent/CN114448895B/en
Publication of CN114448895A publication Critical patent/CN114448895A/en
Application granted granted Critical
Publication of CN114448895B publication Critical patent/CN114448895B/en
Priority to PCT/CN2023/084815 priority patent/WO2023197874A1/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L47/00Traffic control in data switching networks
    • H04L47/10Flow control; Congestion control
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/07Responding to the occurrence of a fault, e.g. fault tolerance
    • G06F11/16Error detection or correction of the data by redundancy in hardware
    • G06F11/20Error detection or correction of the data by redundancy in hardware using active fault-masking, e.g. by switching out faulty elements or by switching in spare elements
    • G06F11/202Error detection or correction of the data by redundancy in hardware using active fault-masking, e.g. by switching out faulty elements or by switching in spare elements where processing functionality is redundant
    • G06F11/2023Failover techniques
    • G06F11/2028Failover techniques eliminating a faulty processor or activating a spare

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Quality & Reliability (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Data Exchanges In Wide-Area Networks (AREA)
  • Information Transfer Between Computers (AREA)

Abstract

The application discloses an application access method, device, equipment and medium, which are applied to the technical field of application access and comprise the following steps: the resolving k8s platform obtains request resolving information based on an endpoint creating request or an endpoint updating request initiated by the request information; acquiring a pod ip list corresponding to the target application from the request analysis information; inquiring the pod information corresponding to each pod ip in the pod ip list; determining a main pod from all pods of the target application based on all pod information and a preset strategy; and replacing the pod ip list in the request information with the pod ip of the primary pod to obtain the replaced request information, so that the k8s platform creates or updates endpoint based on the replaced request information to forward the access traffic of the target application to the primary pod. The complexity of application development can be reduced, and the response performance of application access can be improved.

Description

Application access method, device, equipment and medium
Technical Field
The present application relates to the field of application access technologies, and in particular, to an application access method, apparatus, device, and medium.
Background
In a production environment, high availability of applications is typically achieved through multiple copies, appearing as multiple pods on a container platform, with different request handling mechanisms, multi-master, master-slave, etc. The master-slave mechanism is characterized in that one of the copies serves as a master copy role to respond to the request of the application, the other copies serve as slave copy roles to operate, and when the master copy is abnormal, one of the slave copies is changed into the master copy to take over the flow. The mechanism can ensure atomicity and avoid the problem of inconsistent data processing possibly caused by the simultaneous response of a plurality of copies to a request. The master-slave technology implementation scheme generally develops or integrates a set of election mechanism in source codes, continuously maintains the role of a master copy of a copy by continuously running the election process, responds to a request by the master copy, reselects a new master copy from backup copies when the master copy is disconnected, and forwards the flow to the master copy when the flow reaches the slave copy so as to avoid operating data by the slave copy. The scheme has complex technical principle and is not easy to maintain, and the problem of response performance brought to the master copy by retransmitting the traffic from the slave copy exists.
Disclosure of Invention
In view of this, an object of the present application is to provide an application access method, apparatus, device and medium, which can reduce complexity of application development and improve response performance of application access. The specific scheme is as follows:
in a first aspect, the present application discloses an application access method applied to a preset admission controller, including:
the resolving k8s platform obtains request resolving information based on an endpoint creating request or an endpoint updating request initiated by the request information;
acquiring a pod ip list corresponding to the target application from the request analysis information;
inquiring the pod information corresponding to each pod ip in the pod ip list;
determining a main pod from all pods of the target application based on all the pod information and a preset strategy;
replacing the pod ip list in the request information with the pod ip of the main pod to obtain the replaced request information, so that the k8s platform creates or updates endpoint based on the replaced request information, and the access traffic of the target application is forwarded to the main pod.
Optionally, the method further includes:
acquiring an endpoint name from the request analysis information;
correspondingly, before the querying the pod information corresponding to each pod ip in the pod ip list, the method further includes:
inquiring service information based on the endpoint name; wherein, the service information is the service information corresponding to the endpoint;
judging whether a preset master-slave label exists in the service information or not;
and if the preset master-slave label exists and the value of the preset master-slave label is a first preset value, triggering the step of inquiring the pod information corresponding to each pod ip in the pod ip list.
Optionally, the method further includes:
and if the preset master-slave label does not exist, or the preset master-slave label exists and the value of the preset master-slave label is a second preset value, not performing any treatment.
Optionally, the determining a main pod from all the pods of the target application based on all the pod information and a preset policy includes:
and determining one pod with the earliest creation time from all pods of the target application based on all the pod information and a preset strategy to serve as a main pod.
Optionally, the determining a main pod from all the pods of the target application based on all the pod information and a preset policy includes:
and determining a pod with the latest creation time from all the pods of the target application based on all the pod information and a preset strategy to serve as a main pod.
Optionally, before the analyzing k8s platform initiates an endpoint creation request or an endpoint update request based on the request information, the method further includes:
and acquiring the endpoint creation request or the endpoint updating request initiated by the k8s platform based on an admission webhook mechanism.
In a second aspect, the present application discloses an application access apparatus, which is applied to a pre-admission controller, and includes:
the request analysis module is used for analyzing an endpoint creation request or an endpoint updating request initiated by the k8s platform based on the request information to obtain request analysis information;
the list acquisition module is used for acquiring a pod ip list corresponding to the target application from the request analysis information;
the information query module is used for querying the pod information corresponding to each pod ip in the pod ip list;
a main pod determining module, configured to determine a main pod from all pods of the target application based on all the pod information and a preset policy;
and the information updating module is configured to replace the pod ip list in the request information with a pod ip of the primary pod to obtain post-replacement request information, so that the k8s platform creates or updates endpoint based on the post-replacement request information, and forwards the access traffic of the target application to the primary pod.
Optionally, the method further includes:
an endpoint name obtaining module, configured to obtain an endpoint name from the request resolution information;
a service information query module, configured to query service information based on the endpoint name; wherein, the service information is the service information corresponding to the endpoint;
the master-slave label judging module is used for judging whether a preset master-slave label exists in the service information; and if the preset master-slave label exists and the value of the preset master-slave label is a first preset value, triggering the information query module to execute the step of querying the pod information corresponding to each pod ip in the pod ip list.
In a third aspect, the present application discloses an electronic device comprising a processor and a memory; wherein,
the memory is used for storing a computer program;
the processor is configured to execute the computer program to implement the foregoing application access method.
In a fourth aspect, the present application discloses a computer readable storage medium for storing a computer program, wherein the computer program, when executed by a processor, implements the aforementioned application access method.
It can be seen that, in the present application, an endpoint creation request or an endpoint update request initiated by a k8s platform based on request information is firstly analyzed to obtain request analysis information, then a pod ip list corresponding to a target application is obtained from the request analysis information, and the pod information corresponding to each pod ip in the pod ip list is queried, then a main pod is determined from all pods of the target application based on all the pod information and a preset policy, and finally the pod ip list in the request information is replaced with a pod ip of the main pod to obtain replaced request information, so that the k8s platform creates or updates endpoint based on the replaced request information, and forwards access traffic of the target application to the main pod. That is, the access controller is preset to analyze an endpoint creation request or an endpoint update request initiated by the k8s platform based on the request information to obtain request analysis information, a main point is determined based on the request analysis information and a preset strategy, a point ip list in the request information is replaced by a point ip of the main point, and the k8s platform can forward access traffic of the target application to the main point based on the endpoint created or updated by the request information, so that a complex election mechanism which is difficult to maintain and performance problems caused by the forwarded traffic of a slave copy are avoided, complexity of application development can be reduced, and response performance of application access is improved.
Drawings
In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings needed to be used in the description of the embodiments or the prior art will be briefly introduced below, it is obvious that the drawings in the following description are only embodiments of the present application, and for those skilled in the art, other drawings can be obtained according to the provided drawings without creative efforts.
FIG. 1 is a flow chart of an application access method disclosed herein;
FIG. 2 is a schematic diagram of a specific application access scheme provided herein;
FIG. 3 is a schematic diagram of an application access device according to the present disclosure;
fig. 4 is a block diagram of an electronic device disclosed in the present application.
Detailed Description
The technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application, and it is obvious that the described embodiments are only a part of the embodiments of the present application, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present application.
First, the key terms involved in the scheme of the present application are explained: kubernets: the universal open-source container arrangement architecture of the container cloud platform can realize automatic scheduling, expansion, fault recovery and the like of the container, and is called k8s for short. kube-apiserver: the related operations of the external service API of k8s and all resources in k8s need to call a kube-API correlation interface to be realized. And (3) workload: the deployment form of the application component on the k8s includes various forms such as deployment (stateless load)/stateful load/job/cronjob (timed task)/daemonset (daemon). Each workload may manage 1 or more pods. pod: the smallest management unit of k8s, consists of 1 or more containers that share a process, network, etc. namespace. service: k8s is an object resource designed to satisfy requests for workloads, matching the pod under the workload with labelselector, and providing load balancing capability to forward traffic to different pods. endPoint: and after the service is created, selecting the pod corresponding to the workload according to the labelselector of the service. And the access to the service is loaded to a certain pod ip and port on the endpoint after load balancing.
At present, a master-slave technical implementation scheme generally develops or integrates a set of election mechanism in source code, a master copy role of a copy is continuously maintained by continuously running an election process, the master copy responds to a request, when the master copy is disconnected, a new master copy is reselected from backup copies, and when traffic reaches a slave copy, the slave copy needs to forward the traffic to the master copy, so that data operation of the slave copy is avoided. The scheme has complex technical principle and is not easy to maintain, and the problem of response performance brought to the master copy by retransmitting the traffic from the slave copy exists. Therefore, the application access scheme is disclosed, and can reduce the complexity of application development and improve the response performance of application access.
Referring to fig. 1, an embodiment of the present application discloses an application access method applied to a preset admission controller, including:
step S11: the resolution k8s platform obtains the requested resolution information based on the endpoint creation request or endpoint update request initiated by the request information.
The request information includes the pod ip of all pods of the target application found by the k8s platform and the endpoint name of the endpoint to be created or updated. In a specific implementation manner, the embodiment of the present application acquires the endpoint creation request or the endpoint update request initiated by the k8s platform based on an admission webhook mechanism.
It should be noted that most current container cloud platforms are based on a k8s framework, and provide a functional architecture with application management as a core to users. The containerized applications are deployed on the k8s cluster in the form of workloads, each of which may run 1 or more instances (pod) simultaneously. K8s provides a service mechanism to enable access to workloads, each service having a corresponding access address outside or inside the cluster, and provides load balancing functionality to enable load access to multiple pods. After each service is created, k8s creates an endpoint resource with the same name in real time, where the resource includes all the points ip and ports to which the service is to be loaded, and accesses to the service are loaded to a certain point ip and port on the endpoint after load balancing. Further, k8s provides an admission webhook mechanism, which allows a user-defined admission controller to be called in the process of creating resources to perform verification and modification actions, and based on this, in the embodiment of the present application, a master-slave high-availability admission controller is developed based on service and endpoint resource management of k8s and in combination with the webhook mechanism, so as to obtain a preset admission controller, and the preset admission controller is deployed on a container platform in advance and registered in a k8s platform. k8s calls the preset admission controller when creating the endpoint, and transmits an endpoint creation request to the preset admission controller.
Step S12: and acquiring a pod ip list corresponding to the target application from the request analysis information.
Further, in the embodiment of the present application, an endpoint name may also be obtained from the request parsing information; inquiring service information based on the endpoint name; wherein, the service information is the service information corresponding to the endpoint; judging whether a preset master-slave label exists in the service information or not; and if the preset master-slave label exists and the value of the preset master-slave label is a first preset value, triggering and inquiring the pod information corresponding to each pod ip in the pod ip list. And if the preset master-slave label does not exist, or the preset master-slave label exists and the value of the preset master-slave label is a second preset value, not performing any treatment.
It should be noted that the endpoint name is a service name, and therefore, the service information may be queried based on the endpoint name. And when the application developer establishes the service for the application, the application developer can add a label to the service according to whether the requirement of master-slave high availability exists or not, namely, the master-slave label is preset. Whether the service has the label or not can be judged in the preset access controller, the subsequent main pod selection process is executed for the service with the label, and the subsequent main pod selection process can be started or closed by configuring different values for the label according to requirements, so that the effects of simple configuration and no influence on other applications are achieved. For example, the first preset value is true, and the second preset value is false.
Step S13: and inquiring the pod information corresponding to each pod ip in the pod ip list.
The pod information may include, among other things, creation time, name, etc.
Step S14: and determining a main pod from all the pods of the target application based on all the pod information and a preset strategy.
In an embodiment, a pod with the earliest creation time may be determined from all the pods of the target application based on all the pod information and a preset policy, and the pod may be used as a master pod. It can be appreciated that the pod created earliest is relatively stable.
In another embodiment, a pod with the latest creation time may be determined from all the pods of the target application based on all the pod information and a preset policy, and the determined pod is used as a master pod. It is to be appreciated that the latest pod created is a pod created based on the latest application, facilitating provision of updated application services.
In a specific embodiment, all the pods may be sorted according to the creation time, and the main pod may be determined according to the sorting result.
Of course, in some embodiments, the master pod may also be determined by other strategies.
Step S15: replacing the pod ip list in the request information with the pod ip of the main pod to obtain the replaced request information, so that the k8s platform creates or updates endpoint based on the replaced request information, and the access traffic of the target application is forwarded to the main pod.
It should be noted that, in the present application, the request information may be a global variable, so that the preset admission controller may directly modify the request information.
When the k8s platform monitors that the pod of the target application changes, an endpoint update request is initiated; and when any pod in the target application is abnormal, or is deleted, or is newly added, the pod of the target application is judged to be changed. That is, in the process of creating an endpoint for a service, the embodiment of the present application calls a preset admission controller, queries associated point information according to all point ips in a current endpoint creation request, screens a primary point from all points according to a preset policy, and replaces a point ip list in the request information with the point ip of the point, so that a request traffic passing through the service is only forwarded to the point, and the point is used as a primary copy response request. When the point corresponding to the application changes, k8s will automatically trigger the endpoint update request in real time, and also call the preset admission controller through the admission webhook mechanism, and select a new point as the master point again based on the same logic when creating the endpoint. Thus, based on the service/endpoint resource management of k8s and the adminission webhook mechanism, by developing a webhook program, in the process of creating or updating endpoint for the service, a certain point ip is selected as a point ip in the endpoint according to a preset strategy, that is, a point is selected as a rear end of a service load, so that traffic is directly forwarded to the point. Therefore, a master-slave high-availability access mechanism of multi-copy application is realized, an application does not need to develop a master-slave election mechanism independently, the application can be concentrated on the service logic of the application, the performance problem caused by forwarding of flow to a slave copy is avoided, and the application can be used for all applications with requirements of a cluster by one-time development and deployment. The whole scheme is simple and flexible, is easy to expand, and has good reusability and expandability as long as a new pod selection strategy directly modifies the processing logic of the controller.
For example, referring to fig. 2, fig. 2 is a schematic diagram of a specific application access scheme disclosed in an embodiment of the present application. The client side initiates a service creating request, adds a master-slave processing label for the service, and sets the labelselector of the service as the label of the application. k8s receives the request, creates service, and queries all the points corresponding to the application according to labelselectror to obtain a point ip list, and then determines the request information, initiates an endpoint creation request based on the request information, and calls a registered administration controller (preset admission controller), and when detecting that a point is abnormal, deleted, or added, automatically initiates an endpoint update request based on the current request information, and the service processing logic of the preset admission controller is as follows: analyzing an endPoint establishing or updating request to obtain request analysis information; acquiring an endpoint name, a point ip list and the like from the request analysis information; inquiring service information according to the endpoint name; and judging whether the service has a master-slave label, if the label exists and the value is true, indicating that the service needs master-slave access, performing subsequent processing logic, and if the label does not exist, indicating that the service does not need master-slave access, not continuously executing, and directly completing. The subsequent processing logic includes: inquiring all pod information according to the pod ip list, and sequencing according to the creation time from morning to night to obtain a first pod ip; and replacing the ip list in the original request information by the screened-out pod ip so that the k8 creates or updates endpoint based on the updated request information.
It can be seen that, in the embodiment of the present application, an endpoint creation request or an endpoint update request initiated by a k8s platform based on request information is firstly analyzed to obtain request analysis information, then a pod ip list corresponding to a target application is obtained from the request analysis information, and a pod information corresponding to each pod ip in the pod ip list is queried, then a main pod is determined from all pods of the target application based on all the pod information and a preset policy, and finally the pod ip list in the request information is replaced with a pod ip of the main pod to obtain replaced request information, so that the k8s platform creates or updates endpoint based on the replaced request information, and then the access traffic of the target application is all forwarded to the main pod. That is, in the embodiment of the present application, the preset admission controller parses an endpoint creation request or an endpoint update request initiated by the k8s platform based on the request information to obtain request parsing information, and determines a primary point based on the request parsing information and the preset policy, a point ip list in the request information is replaced by a point ip of the primary point, and the k8s platform creates or updates the endpoint based on the request information, and can forward access traffic of the target application to the primary point, thereby avoiding a complex election mechanism which is difficult to maintain, and performance problems caused by forwarding traffic of a copy, reducing complexity of application development, and improving response performance of application access.
Referring to fig. 3, an embodiment of the present application discloses an application access apparatus, which is applied to a pre-admission controller, and includes:
the request analysis module 11 is configured to analyze an endpoint creation request or an endpoint update request initiated by the k8s platform based on the request information to obtain request analysis information;
a list obtaining module 12, configured to obtain a pod ip list corresponding to the target application from the request parsing information;
an information query module 13, configured to query pod information corresponding to each pod ip in the pod ip list;
a main pod determining module 14, configured to determine a main pod from all pods of the target application based on all the pod information and a preset policy;
an information updating module 15, configured to replace the pod ip list in the request information with a pod ip of the primary pod to obtain post-replacement request information, so that the k8s platform creates endpoint or updates based on the post-replacement request information, and forwards the access traffic of the target application to the primary pod.
It can be seen that, in the embodiment of the present application, an endpoint creation request or an endpoint update request initiated by a k8s platform based on request information is firstly analyzed to obtain request analysis information, then a pod ip list corresponding to a target application is obtained from the request analysis information, and a pod information corresponding to each pod ip in the pod ip list is queried, then a main pod is determined from all pods of the target application based on all the pod information and a preset policy, and finally the pod ip list in the request information is replaced with a pod ip of the main pod to obtain replaced request information, so that the k8s platform creates or updates endpoint based on the replaced request information, and then the access traffic of the target application is all forwarded to the main pod. That is, in the embodiment of the present application, the preset admission controller parses an endpoint creation request or an endpoint update request initiated by the k8s platform based on request information to obtain request parsing information, and determines a primary point based on the request parsing information and a preset policy, and replaces a point ip list in the request information with a point ip of the primary point, and the k8s platform creates or updates the endpoint based on the request information, and can forward access traffic of a target application to the primary point, thereby avoiding a complex election mechanism which is difficult to maintain, and performance problems caused by forwarding traffic of a copy, reducing complexity of application development, and improving response performance of application access.
Further, the apparatus further comprises: and the endpoint name acquisition module is used for acquiring an endpoint name from the request analysis information.
Correspondingly, the device further comprises:
a service information query module, configured to query service information based on the endpoint name; wherein, the service information is the service information corresponding to the endpoint;
the master-slave label judging module is used for judging whether a preset master-slave label exists in the service information; if the preset master-slave label exists and the value of the preset master-slave label is a first preset value, the trigger information query module 13 executes the step of querying the pod information corresponding to each pod ip in the pod ip list. And if the preset master-slave label does not exist, or the preset master-slave label exists and the value of the preset master-slave label is a second preset value, not performing any treatment.
In an embodiment, the master pod determining module 14 is specifically configured to determine, as the master pod, a pod with the earliest creation time from all the pods of the target application based on all the pod information and a preset policy.
In another embodiment, the master pod determining module 14 is specifically configured to determine, as the master pod, a pod with the latest creation time from all the pods of the target application based on all the pod information and a preset policy.
Further, the apparatus further includes a request obtaining module, configured to obtain, based on an admission webhook mechanism, the endpoint creation request or the endpoint update request initiated by the k8s platform.
Referring to fig. 4, an embodiment of the present application discloses an electronic device 20, which includes a processor 21 and a memory 22; wherein, the memory 22 is used for saving computer programs; the processor 21 is configured to execute the computer program and the application access method disclosed in the foregoing embodiment.
For the specific process of the application access method, reference may be made to corresponding contents disclosed in the foregoing embodiments, and details are not repeated here.
The memory 22 is used as a carrier for resource storage, and may be a read-only memory, a random access memory, a magnetic disk or an optical disk, and the storage mode may be a transient storage mode or a permanent storage mode.
In addition, the electronic device 20 further includes a power supply 23, a communication interface 24, an input-output interface 25, and a communication bus 26; the power supply 23 is configured to provide an operating voltage for each hardware device on the electronic device 20; the communication interface 24 can create a data transmission channel between the electronic device 20 and an external device, and a communication protocol followed by the communication interface is any communication protocol applicable to the technical solution of the present application, and is not specifically limited herein; the input/output interface 25 is configured to obtain external input data or output data to the outside, and a specific interface type thereof may be selected according to a specific application requirement, which is not specifically limited herein.
Further, the embodiment of the present application also discloses a computer readable storage medium for storing a computer program, wherein the computer program implements the application access method disclosed in the foregoing embodiment when being executed by a processor.
For the specific process of the application access method, reference may be made to corresponding contents disclosed in the foregoing embodiments, and details are not repeated here.
The embodiments are described in a progressive manner, each embodiment focuses on differences from other embodiments, and the same or similar parts among the embodiments are referred to each other. The device disclosed by the embodiment corresponds to the method disclosed by the embodiment, so that the description is simple, and the relevant points can be referred to the method part for description.
The steps of a method or algorithm described in connection with the embodiments disclosed herein may be embodied directly in hardware, in a software module executed by a processor, or in a combination of the two. A software module may reside in Random Access Memory (RAM), memory, Read Only Memory (ROM), electrically programmable ROM, electrically erasable programmable ROM, registers, hard disk, a removable disk, a CD-ROM, or any other form of storage medium known in the art.
The foregoing detailed description is directed to an application access method, apparatus, device and medium provided by the present application, and specific examples are applied herein to illustrate the principles and implementations of the present application, and the descriptions of the foregoing examples are only used to help understand the method and the core ideas of the present application; meanwhile, for a person skilled in the art, according to the idea of the present application, there may be variations in the specific embodiments and the application scope, and in summary, the content of the present specification should not be construed as a limitation to the present application.

Claims (8)

1. An application access method applied to a preset admission controller includes:
the resolving k8s platform obtains request resolving information based on an endpoint creating request or an endpoint updating request initiated by the request information;
acquiring a pod ip list corresponding to the target application from the request analysis information;
inquiring the pod information corresponding to each pod ip in the pod ip list;
determining a main pod from all pods of the target application based on all the pod information and a preset strategy;
replacing the pod ip list in the request information with a pod ip of the primary pod to obtain replaced request information, so that the k8s platform creates or updates endpoint based on the replaced request information, and forwards the access traffic of the target application to the primary pod;
the method further comprises the following steps: acquiring an endpoint name from the request analysis information;
correspondingly, before the querying the pod information corresponding to each pod ip in the pod ip list, the method further includes:
inquiring service information based on the endpoint name; wherein, the service information is the service information corresponding to the endpoint;
judging whether a preset master-slave label exists in the service information or not;
and if the preset master-slave label exists and the value of the preset master-slave label is a first preset value, triggering the step of inquiring the pod information corresponding to each pod ip in the pod ip list.
2. The application access method of claim 1, further comprising:
and if the preset master-slave label does not exist, or the preset master-slave label exists and the value of the preset master-slave label is a second preset value, not performing any treatment.
3. The method according to claim 1, wherein the determining a primary pod from all pods of the target application based on all of the pod information and a preset policy comprises:
and determining a pod with the earliest creation time from all the pods of the target application based on all the pod information and a preset strategy to serve as a main pod.
4. The application access method of claim 1, wherein the determining a primary pod from all pods of the target application based on all the pod information and a preset policy comprises:
and determining a pod with the latest creation time from all the pods of the target application based on all the pod information and a preset strategy to serve as a main pod.
5. The application access method according to any one of claims 1 to 4, wherein before the parsing k8s platform initiates an endpoint creation request or an endpoint update request based on the request information, the method further includes:
and acquiring the endpoint creation request or the endpoint updating request initiated by the k8s platform based on an admission webhook mechanism.
6. An application access device applied to a preset admission controller, comprising:
the request analysis module is used for analyzing an endpoint creation request or an endpoint updating request initiated by the k8s platform based on the request information to obtain request analysis information;
the list acquisition module is used for acquiring a pod ip list corresponding to the target application from the request analysis information;
the information query module is used for querying the pod information corresponding to each pod ip in the pod ip list;
a main pod determining module, configured to determine a main pod from all pods of the target application based on all the pod information and a preset policy;
an information updating module, configured to replace the pod ip list in the request information with a pod ip of the primary pod to obtain post-replacement request information, so that the k8s platform creates or updates endpoint based on the post-replacement request information, and forwards access traffic of the target application to the primary pod;
the device further comprises:
an endpoint name obtaining module, configured to obtain an endpoint name from the request resolution information;
a service information query module, configured to query service information based on the endpoint name; wherein, the service information is the service information corresponding to the endpoint;
the master-slave tag judgment module is used for judging whether the service information contains a preset master-slave tag or not; and if the preset master-slave label exists and the value of the preset master-slave label is a first preset value, triggering the information query module to execute the step of querying the pod information corresponding to each pod ip in the pod ip list.
7. An electronic device comprising a processor and a memory; wherein,
the memory is used for storing a computer program;
the processor for executing the computer program to implement the application access method of any of claims 1 to 5.
8. A computer-readable storage medium for storing a computer program, wherein the computer program, when executed by a processor, implements the application access method of any of claims 1 to 5.
CN202210371384.2A 2022-04-11 2022-04-11 Application access method, device, equipment and medium Active CN114448895B (en)

Priority Applications (2)

Application Number Priority Date Filing Date Title
CN202210371384.2A CN114448895B (en) 2022-04-11 2022-04-11 Application access method, device, equipment and medium
PCT/CN2023/084815 WO2023197874A1 (en) 2022-04-11 2023-03-29 Application access method and apparatus, and device and medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210371384.2A CN114448895B (en) 2022-04-11 2022-04-11 Application access method, device, equipment and medium

Publications (2)

Publication Number Publication Date
CN114448895A CN114448895A (en) 2022-05-06
CN114448895B true CN114448895B (en) 2022-06-17

Family

ID=81360394

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210371384.2A Active CN114448895B (en) 2022-04-11 2022-04-11 Application access method, device, equipment and medium

Country Status (2)

Country Link
CN (1) CN114448895B (en)
WO (1) WO2023197874A1 (en)

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114448895B (en) * 2022-04-11 2022-06-17 苏州浪潮智能科技有限公司 Application access method, device, equipment and medium
CN115277652B (en) * 2022-06-29 2024-03-22 北京百度网讯科技有限公司 Streaming media processing method and device based on reasoning service and electronic equipment
CN116033010A (en) * 2023-02-16 2023-04-28 北京有竹居网络技术有限公司 Remote access method, device, electronic equipment and storage medium

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112153143A (en) * 2020-09-24 2020-12-29 新浪网技术(中国)有限公司 Kubernetes cluster flow scheduling method and device and electronic equipment
WO2021063339A1 (en) * 2019-09-30 2021-04-08 星环信息科技(上海)股份有限公司 Cluster resource scheduling method, apparatus, device and storage medium
CN114124948A (en) * 2021-09-19 2022-03-01 济南浪潮数据技术有限公司 High-availability method, device, equipment and readable medium for cloud component

Family Cites Families (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US11777790B2 (en) * 2020-04-16 2023-10-03 Ribbon Communications Operating Company, Inc. Communications methods and apparatus for migrating a network interface and/or IP address from one Pod to another Pod in a Kubernetes system
CN113741923A (en) * 2020-05-27 2021-12-03 华为技术有限公司 Application updating method, device, equipment and medium
CN111901157B (en) * 2020-07-10 2023-01-10 苏州浪潮智能科技有限公司 Service deployment method, device, equipment and medium based on k8s
CN114448895B (en) * 2022-04-11 2022-06-17 苏州浪潮智能科技有限公司 Application access method, device, equipment and medium

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2021063339A1 (en) * 2019-09-30 2021-04-08 星环信息科技(上海)股份有限公司 Cluster resource scheduling method, apparatus, device and storage medium
CN112153143A (en) * 2020-09-24 2020-12-29 新浪网技术(中国)有限公司 Kubernetes cluster flow scheduling method and device and electronic equipment
CN114124948A (en) * 2021-09-19 2022-03-01 济南浪潮数据技术有限公司 High-availability method, device, equipment and readable medium for cloud component

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
"Kubernetes概念篇:基本概念和术语";xcbeyond;《https://my.oschina.net/xcbeyond/blog/5055023》;20210521;全文 *
"一文带你看透kubernetes容器编排系统";腾讯云开发者社区;《https://my.oschina.net/qcloudcommunity/blog/2998211》;20190107;全文 *

Also Published As

Publication number Publication date
WO2023197874A1 (en) 2023-10-19
CN114448895A (en) 2022-05-06

Similar Documents

Publication Publication Date Title
CN114448895B (en) Application access method, device, equipment and medium
US10831574B2 (en) Remote procedure call method for network device and network device
EP3886399A1 (en) Method for invoking server and proxy server
US7831734B2 (en) Method and system for remote configuration of network devices
Tiderko et al. The ROS multimaster extension for simplified deployment of multi-robot systems
CN114153566A (en) Cross-processor architecture multi-container inter-cluster service discovery method, device and equipment
US11263186B2 (en) System and method for customized graphQL data-handling scripts
CN112882738A (en) Configuration information updating method and device under micro-service architecture and electronic equipment
US11531526B1 (en) Creating portable serverless applications
CN113079098B (en) Method, device, equipment and computer readable medium for updating route
CN111818188B (en) Load balancing availability improving method and device for Kubernetes cluster
US11082522B2 (en) Information acquisition
US11494184B1 (en) Creation of transportability container files for serverless applications
CN116743762A (en) Service registration cluster flow switching method, flow switching device and storage medium
CN112069152A (en) Database cluster upgrading method, device, equipment and storage medium
US11755297B2 (en) Compiling monoglot function compositions into a single entity
CN113900728B (en) Synchronous configuration method, system, electronic equipment and storage medium
US11513833B1 (en) Event listener interface for container-based execution of serverless functions
CN114584545A (en) Data management method, device, system, storage medium and electronic equipment
CN113918215A (en) Micro-service configuration system, equipment and medium
US20080140687A1 (en) Socket structure simultaneously supporting both toe and ethernet network interface card and method of forming the socket structure
CN115378993B (en) Method and system for supporting namespace-aware service registration and discovery
WO2024066503A1 (en) Service invocation method and apparatus
WO2024012101A1 (en) Distributed-service generation method and system, and computing device and storage medium
JP2009020581A (en) Inter-application communication system

Legal Events

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