Pod positioning method and apparatus, storage medium, and computer device

By obtaining the Pod's Node and its container attribute information, and determining the Pod's location in the preset cluster configuration table, the problem of low Pod location accuracy in the existing technology is solved, and higher-precision Pod location is achieved.

CN116886761BActive Publication Date: 2026-07-14KANG JIAN INFORMATION TECH (SHENZHEN) CO LTD

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
KANG JIAN INFORMATION TECH (SHENZHEN) CO LTD
Filing Date
2023-07-04
Publication Date
2026-07-14

Smart Images

  • Figure CN116886761B_ABST
    Figure CN116886761B_ABST
Patent Text Reader

Abstract

The application discloses a Pod positioning method and device, a storage medium and computer equipment, relates to the field of information technology, and mainly aims at improving the positioning accuracy of a Pod. The method comprises the following steps: acquiring a Node node corresponding to a Pod to be positioned, and acquiring container attribute information corresponding to each container in the Pod to be positioned; determining a cluster where the Node node is located in a preset cluster configuration table according to a Node identifier corresponding to the Node node, wherein different standard Node image identifiers correspond to clusters in the preset cluster configuration table, and different standard Node character identifiers correspond to clusters; determining cluster attribute information of the cluster where the Node node is located; and determining position information where the Pod to be positioned is located according to the container attribute information and the cluster attribute information. The application is suitable for the field of medical science and technology.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of information technology, and in particular to a Pod location method, apparatus, storage medium, and computer device. Background Technology

[0002] A Pod is the smallest scheduling unit in a Kubernetes (container orchestration engine) cluster. A Pod can be called a container group. A Pod represents a process running on Kubernetes. For example, a Pod could be a process running on Kubernetes that retrieves personal medical insurance information. When an anomaly occurs in the process of retrieving personal medical insurance information, it is necessary to perform packet capture analysis on the Pod that is retrieving medical insurance information. Therefore, before performing packet capture analysis on a Pod, it is necessary to first determine the location of the Pod.

[0003] Currently, Pods are typically located solely based on the location of the Node to which they are bound (a Node in Kubernetes can be a physical machine or a virtual machine). However, since multiple Pods can be bound to a single Node, this method of locating Pods based solely on the root Node's location results in low accuracy in Pod location. Summary of the Invention

[0004] This invention provides a Pod location method, apparatus, storage medium, and computer device, which mainly improves the location accuracy of Pods.

[0005] According to a first aspect of the present invention, a Pod location method is provided, comprising:

[0006] Obtain the Node corresponding to the Pod to be located, and obtain the container attribute information corresponding to each container in the Pod to be located;

[0007] Based on the Node identifier corresponding to the Node, the cluster to which the Node belongs is determined in a preset cluster configuration table. The preset cluster configuration table stores clusters corresponding to different standard Node image identifiers and clusters corresponding to different standard Node character identifiers.

[0008] Determine the cluster attribute information of the cluster to which the Node belongs;

[0009] Based on the container attribute information and the cluster attribute information, the location information of the Pod to be located is determined.

[0010] Optionally, obtaining the Node corresponding to the Pod to be located includes:

[0011] Determine the information acquisition interface corresponding to the Pod to be located;

[0012] The Node field is obtained from the information acquisition interface using a preset information acquisition function;

[0013] The Node field is parsed to obtain the Node corresponding to the Pod to be located.

[0014] Optionally, obtaining the container attribute information corresponding to each container in the Pod to be located includes:

[0015] Obtain the container quantity information, IP address information, tag information, port information, replica quantity information, container image name, port protocol type, and network interface information for each container in the Pod to be located.

[0016] Optionally, determining the cluster to which the Node belongs in a preset cluster configuration table based on the Node identifier corresponding to the Node includes:

[0017] Determine the identifier type to which the Node identifier belongs;

[0018] If the identifier type is a Node image identifier, then the cluster where the Node belongs is determined in the preset cluster configuration table using an image similarity matching algorithm;

[0019] If the identifier type is a Node character identifier, then the cluster where the Node belongs is determined in the preset cluster configuration table using a character similarity matching algorithm.

[0020] Optionally, determining the cluster where the Node belongs using an image similarity matching algorithm in the preset cluster configuration table includes:

[0021] Determine the first image feature vector corresponding to the Node image identifier, and determine the second image feature vector corresponding to each standard Node image identifier in the preset cluster configuration table;

[0022] Based on the first image feature vector and the second image feature vector, calculate the cosine similarity between the Node image identifier and each standard Node image identifier;

[0023] Among the cosine similarities, the maximum cosine similarity is determined, and the target standard Node image identifier corresponding to the maximum cosine similarity is determined. The cluster corresponding to the target standard Node image identifier is determined as the cluster where the Node is located.

[0024] Optionally, determining the cluster where the Node belongs using a character similarity matching algorithm in the preset cluster configuration table includes:

[0025] Using a preset character length as the unit, the Node character identifier and each standard Node character identifier are segmented to obtain at least one first segmented string corresponding to the Node character identifier and at least one second segmented string corresponding to each standard Node character identifier;

[0026] The first segmented string is matched with each of the second segmented strings to obtain the matching results;

[0027] Determine the target standard Node character identifier corresponding to the second segment string with the most matching characters in the matching results, and determine the cluster corresponding to the target standard Node character identifier as the cluster where the Node is located.

[0028] Optionally, determining the location information of the Pod to be located based on the container attribute information and the cluster attribute information includes:

[0029] Based on the container attribute information and the cluster attribute information, determine the network interface information and IP address information corresponding to the Pod to be located;

[0030] The location of the Pod to be located is determined based on the network card information and IP address information corresponding to the Pod to be located.

[0031] According to a second aspect of the present invention, a Pod positioning device is provided, comprising:

[0032] The acquisition unit is used to acquire the Node corresponding to the Pod to be located, and to acquire the container attribute information corresponding to each container in the Pod to be located;

[0033] The first determining unit is used to determine the cluster to which the Node belongs in a preset cluster configuration table based on the Node identifier corresponding to the Node. The preset cluster configuration table stores clusters corresponding to different standard Node image identifiers and clusters corresponding to different standard Node character identifiers.

[0034] The second determining unit is used to determine the cluster attribute information of the cluster to which the Node node belongs;

[0035] The positioning unit is used to determine the location information of the Pod to be located based on the container attribute information and the cluster attribute information.

[0036] According to a third aspect of the present invention, a computer-readable storage medium is provided having a computer program stored thereon that, when executed by a processor, implements the above-described Pod location method.

[0037] According to a fourth aspect of the present invention, a computer device is provided, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the program to implement the above-described Pod location method.

[0038] According to the Pod location method, apparatus, storage medium, and computer device provided by the present invention, compared with the current method of locating a Pod solely based on the location of the Node to which the Pod is bound, the present invention obtains the Node corresponding to the Pod to be located, and obtains the container attribute information corresponding to each container in the Pod to be located; and determines the cluster where the Node is located in a preset cluster configuration table based on the Node identifier corresponding to the Node, wherein the preset cluster configuration table stores clusters corresponding to different standard Node image identifiers and clusters corresponding to different standard Node character identifiers; then determines the cluster attribute information of the cluster where the Node is located; finally, the location information of the Pod to be located is determined based on the container attribute information and the cluster attribute information. Thus, the cluster where the Pod is located is determined by the Node where the Pod is located, and the cluster attribute information of the cluster where the Pod is located is determined. At the same time, the container attribute information corresponding to each container in the Pod is also determined. Finally, the Pod is located based on the cluster attribute information and the container attribute information. In the process of Pod location, by comprehensively analyzing all information related to the Pod's location, the Pod location accuracy can be improved. Attached Figure Description

[0039] The accompanying drawings, which are included to provide a further understanding of the invention and form part of this application, illustrate exemplary embodiments of the invention and, together with their description, serve to explain the invention and do not constitute an undue limitation thereof. In the drawings:

[0040] Figure 1 A flowchart of a Pod location method provided by an embodiment of the present invention is shown;

[0041] Figure 2 A flowchart of another Pod location method provided by an embodiment of the present invention is shown;

[0042] Figure 3 A schematic diagram of a Pod positioning device provided in an embodiment of the present invention is shown;

[0043] Figure 4 This invention provides a schematic diagram of another Pod positioning device according to an embodiment of the invention.

[0044] Figure 5 A schematic diagram of the physical structure of a computer device provided in an embodiment of the present invention is shown. Detailed Implementation

[0045] The present invention will be described in detail below with reference to the accompanying drawings and embodiments. It should be noted that, unless otherwise specified, the embodiments and features described in the present application can be combined with each other.

[0046] Currently, the method of locating a Pod based solely on the location of the Node it is bound to does not fully consider other information related to the Pod's location, resulting in low Pod location accuracy.

[0047] To address the above problems, embodiments of the present invention provide a Pod location method, such as... Figure 1 As shown, the method includes:

[0048] 101. Obtain the Node corresponding to the Pod to be located, and obtain the container attribute information corresponding to each container in the Pod to be located.

[0049] Kubernetes Cluster is an open-source application for managing containerized applications on container cluster hosts. It provides a mechanism for deploying, planning updates, and maintaining containerized applications, with the goal of making the deployment of containerized applications simple and efficient.

[0050] A Pod, also known as a container group, is the smallest or simplest scheduling unit for deploying or managing a Kubernetes cluster. A Pod represents a process running on a Kubernetes cluster. A Pod contains multiple containers. For example, a Pod can be a process running on Kubernetes that retrieves personal medical insurance information or queries personal health records.

[0051] A Node is a worker machine in a Kubernetes cluster. A Node is typically a virtual machine or a physical machine. Each Node can have multiple Pods, and Pods always run on a Node.

[0052] The container attribute information includes: container quantity, IP address, tag information, port information, number of replicas, container name, container image name, port protocol type, network interface information, etc.

[0053] In this embodiment of the invention, the node where the Pod to be located is located is first obtained using commands in the kubectl plugin, and the containers contained in the Pod to be located are determined. Then, the total number, IP address information, tag information, port information, number of replicas, container name, container image name, port protocol type, network card information, and mounted storage information of each container are obtained using commands in the kubectl plugin. The node information can be obtained using the command kubectl describe pod podname -n namespaces in the kubectl plugin, and the container attribute information can also be obtained using the above commands. Thus, multiple types of information can be obtained with only one command, thereby improving the efficiency of information acquisition and reducing the information acquisition chain.

[0054] 102. Based on the Node identifier corresponding to the Node, determine the cluster where the Node belongs in the preset cluster configuration table.

[0055] A cluster refers to a group (or several) of independent computers that form a large computer service system using a high-speed communication network. Each node (i.e., each computer in the cluster) is an independent server running its own services. These servers can communicate with each other and work together to provide users with applications, system resources, and data, and are managed in a single system mode. When a user requests a cluster system, the cluster gives the user the impression of a single independent server, but in reality, the user is requesting a group of cluster services.

[0056] The node identifier can be an icon or a character identifier. As long as the node can be uniquely identified by the node identifier, the embodiment of the present invention does not impose specific limitations on the form of the node identifier. The preset cluster configuration table stores the clusters corresponding to different standard node image identifiers and the clusters corresponding to different standard node character identifiers.

[0057] In this embodiment of the invention, the node identifier is matched with each standard node identifier stored in the preset cluster configuration table. Based on the matching result, the target standard node identifier that matches the bode identifier is determined in the preset cluster configuration table. Finally, the cluster corresponding to the target standard bode identifier is determined as the cluster where the Node node is located. Then, the cluster attribute information of the cluster where the Node node is located is determined. Finally, the pod is located based on the container attribute information and the cluster attribute information. Thus, when locating a pod, by comprehensively considering all information related to the pod's location, the accuracy of pod location can be improved.

[0058] 103. Determine the cluster attribute information of the cluster where the Node node is located.

[0059] The cluster attribute information includes: the number of nodes in the cluster, the cluster type (including high availability cluster or high performance computing cluster), the pod tags and the number of pods running in the cluster, etc.

[0060] In this embodiment of the invention, the cluster operation log information records the cluster's attribute information. The cluster attribute information can be determined from the operation log information. At the same time, the cluster attribute information can also be obtained by calling the pre-information acquisition function. For example, the pre-information acquisition function can be the command kubectl describe node nodename. Then, based on the cluster attribute information and container attribute information, the pod can be located. Thus, when locating the pod, by comprehensively considering all information related to the pod's location, the accuracy of pod location can be improved.

[0061] 104. Determine the location of the Pod to be located based on the container attribute information and cluster attribute information.

[0062] In this embodiment of the invention, after obtaining container attribute information such as the number of containers, IP address information, tag information, port information, number of replicas, container name, container image name, port protocol type, and network interface information for each container in the pod, and obtaining cluster attribute information such as the number of nodes in the cluster where the pod is located, cluster type (including high-availability cluster or high-performance computing cluster), pod tags and number of pods running in the cluster, the location information of the pod to be located is parsed based on the above container attribute information and cluster attribute information, thus completing the location of the pod to be located. Therefore, by comprehensively analyzing all information related to the location of the pod during the pod location process, the accuracy of pod location can be improved.

[0063] According to the Pod location method provided by the present invention, compared with the current method of locating Pods solely based on the location of the Node to which the Pod is bound, the present invention obtains the Node corresponding to the Pod to be located, and the container attribute information corresponding to each container in the Pod to be located; and determines the cluster where the Node is located in a preset cluster configuration table based on the Node identifier corresponding to the Node, wherein the preset cluster configuration table stores clusters corresponding to different standard Node image identifiers and clusters corresponding to different standard Node character identifiers; then determines the cluster attribute information of the cluster where the Node is located; finally, the location information of the Pod to be located is determined based on the container attribute information and the cluster attribute information. Thus, the cluster where the Pod is located is determined by the Node where the Pod is located, and the cluster attribute information of the cluster where the Pod is located is determined. At the same time, the container attribute information corresponding to each container in the Pod is also determined. Finally, the Pod is located based on the cluster attribute information and the container attribute information. In the process of Pod location, by comprehensively analyzing all information related to the Pod's location, the Pod location accuracy can be improved.

[0064] Furthermore, to better illustrate the above process of locating a Pod, as a refinement and extension of the above embodiments, this embodiment of the invention provides another method for locating a Pod, such as... Figure 2 As shown, the method includes:

[0065] 201. Obtain the Node corresponding to the Pod to be located, and obtain the container attribute information corresponding to each container in the Pod to be located.

[0066] In this embodiment of the invention, to locate a pod, it is first necessary to obtain the Node corresponding to the pod. Based on this, step 201 specifically includes: determining the information acquisition interface corresponding to the pod to be located; using a preset information acquisition function to obtain the Node field in the information acquisition interface; and parsing the Node field to obtain the Node corresponding to the pod to be located.

[0067] Specifically, first determine the information retrieval interface corresponding to the pod, then call the command `kubectl describe pod podname -n namespaces` to get the output content and then parse the node field. By parsing the node field, you can get the node name. After that, you can also use the command `kubectl describe pod podname -XXX` to get the container attribute information such as the number of containers, IP address information, tag information, port information, number of replicas information, container image name, port protocol type, and network card information for each container in the pod.

[0068] 202. Determine the identifier type to which the Node identifier belongs.

[0069] The identification types include icon identification and character identification.

[0070] In this embodiment of the invention, in order to determine the cluster where the node belongs, it is first necessary to determine whether the identifier corresponding to the node is an icon identifier or a character identifier. If it is an icon identifier, the algorithm corresponding to the icon identifier is used to determine the cluster where the node belongs. If the node identifier is a character identifier, the algorithm corresponding to the character identifier is used to determine the cluster where the node belongs. This can improve the flexibility of determining the cluster where the node belongs.

[0071] 203. If the identifier type is Node image identifier, then the cluster where the Node is located is determined in the preset cluster configuration table using the image similarity matching algorithm.

[0072] In this embodiment of the invention, after determining the identifier type of the node identifier, if the node identifier belongs to an icon identifier, it is necessary to use an image similarity matching algorithm to determine the cluster where the Node is located in the preset cluster configuration table. Based on this, step 203 specifically includes: determining the first image feature vector corresponding to the Node image identifier, and determining the second image feature vector corresponding to each standard Node image identifier in the preset cluster configuration table; calculating the cosine similarity between the Node image identifier and each standard Node image identifier based on the first image feature vector and the second image feature vector; determining the maximum cosine similarity among the cosine similarities, and determining the target standard Node image identifier corresponding to the maximum cosine similarity, and determining the cluster corresponding to the target standard Node image identifier as the cluster where the Node is located.

[0073] Specifically, firstly, the node image identifier is input into a preset image feature extraction model for feature extraction to obtain the first image feature vector corresponding to the node image identifier. Secondly, each standard node image identifier is input into a preset image feature extraction model for feature extraction to obtain the second image feature vector corresponding to each standard node image identifier. The preset image feature extraction model can be a preset encoder, which includes an attention layer and a feedforward neural network layer. Based on this, the specific method for obtaining the first and second image feature vectors includes: determining the first pixel matrix corresponding to the node image identifier; horizontally concatenating the pixels in each row of the first pixel matrix to obtain the third image feature vector corresponding to the node image identifier; inputting the third image feature vector into different attention subspaces in the attention layer for feature extraction to obtain the fourth image feature vector of the node image identifier in different attention subspaces; multiplying the fourth image feature vector of the node image identifier in different attention subspaces with the weights corresponding to the different attention subspaces and summing the results to obtain the attention layer output vector corresponding to the node image identifier; adding the attention layer output vector and the third image feature vector to obtain the fifth image feature vector corresponding to the node image identifier; and inputting the fifth image feature vector into the feedforward neural network layer for feature extraction to obtain the first image feature vector corresponding to the node image identifier. Similarly, the method for obtaining the second image feature vector corresponding to the standard node image identifier is as follows: determine the second pixel matrix corresponding to the standard node image identifier; horizontally concatenate the pixels in each row of the second pixel matrix to obtain the sixth image feature vector corresponding to the node image identifier; input the sixth image feature vector into different attention subspaces in the attention layer for feature extraction to obtain the seventh image feature vector of the node image identifier in different attention subspaces; multiply the seventh image feature vector of the node image identifier in different attention subspaces with the weights corresponding to the different attention subspaces and sum them to obtain the attention layer output vector corresponding to the node image identifier; add the attention layer output vector and the sixth image feature vector to obtain the eighth image feature vector corresponding to the node image identifier; input the eighth image feature vector into the feedforward neural network layer for feature extraction to obtain the second image feature vector corresponding to the node image identifier.

[0074] Furthermore, after determining the first image feature vector corresponding to each node image identifier and the second image feature vector corresponding to each standard node image identifier, the cosine similarity between the node image identifier and each standard node image identifier can be calculated using the following formula:

[0075]

[0076] Where cos(θ) represents the cosine similarity between the node image label and each standard node image label, x i y represents each vector element in the feature vector of the first image. i Let represent each vector element in the second image feature vector, where i represents the i-th vector element in either the first or second image feature vector, and n represents the number of vector elements in the first image feature vector. Based on the above formula, the cosine similarity between the node image identifier and each standard node image identifier can be calculated. Then, based on each cosine similarity, the cluster to which the node belongs is determined. For example, if the cosine similarity between the node image identifier and standard node image identifier 1 is 20%, the cosine similarity between the node image identifier and standard node image identifier 2 is 30%, and the cosine similarity between the node image identifier and standard node image identifier 3 is 50%, then the cluster corresponding to standard node image identifier 3 is finally found in the preset cluster configuration table, and the cluster corresponding to node image identifier 3 is determined as the cluster to which the node belongs. This method of determining the cluster to which the node belongs through a similarity matching algorithm improves the efficiency and accuracy of cluster determination.

[0077] 204. If the identifier type is Node character identifier, the cluster where the Node is located is determined in the preset cluster configuration table using a character similarity matching algorithm.

[0078] In this embodiment of the invention, after determining the identifier type of the node identifier, if the node identifier belongs to a character identifier, it is necessary to use a character similarity matching algorithm to determine the cluster where the Node is located in the preset cluster configuration table. Based on this, step 204 specifically includes: segmenting the Node character identifier and each standard Node character identifier in units of preset character length to obtain at least one first segmented string corresponding to the Node character identifier and at least one second segmented string corresponding to each standard Node character identifier; matching the first segmented string with each of the second segmented strings to obtain matching results; determining the target standard Node character identifier corresponding to the second segmented string with the most matching characters in the matching results, and determining the cluster corresponding to the target standard Node character identifier as the cluster where the Node is located.

[0079] Specifically, the node character identifier is segmented using a preset character length as the unit to obtain at least one first segmented string corresponding to the node character identifier. Simultaneously, each standard node character identifier recorded in the preset cluster configuration table is segmented to obtain at least one second segmented string corresponding to each standard node character identifier. Then, the number of identical characters in the first and second segmented strings is determined, and the maximum number of identical characters is determined among these. Finally, the standard node character identifier corresponding to the maximum number of identical characters is determined as the target standard node character identifier. For example, if the node character identifier is 113233, the standard node character identifiers recorded in the preset cluster configuration table include: standard node character identifier 1: 123356, standard node character identifier 2: 123356, and so on. Given the node identifier 2: 113233 and the standard node character identifier 3: 123500, the node character identifier is segmented to obtain the first segmented string 1 / 1 / 3 / 2 / 3 / 3. At the same time, each standard node character identifier recorded in the preset cluster configuration table is segmented to obtain 1 / 2 / 3 / 3 / 5 / 6, 1 / 1 / 3 / 2 / 3 / 3, and 1 / 2 / 3 / 5 / 0 / 0. The first segmented string is matched with the second segmented string. Finally, the node character identifier that matches the character in the standard node character identifier 2 the most is determined to be the target standard node character identifier. Then, the cluster corresponding to the target standard node character identifier is determined in the preset cluster configuration table, and finally, this cluster is determined to be the cluster where the node node is located.

[0080] 205. Determine the cluster attribute information of the cluster where the Node node is located.

[0081] In this embodiment of the invention, after determining the cluster where a node belongs using a character similarity matching algorithm or an image similarity matching algorithm, it is also necessary to determine the cluster attribute information corresponding to that cluster. Therefore, to avoid obtaining the cluster attribute information through many cumbersome steps, this embodiment of the invention develops a kubectl plugin tool. Using this plugin, cluster attribute information can be customized with a single command. The plugin installation process is as follows: Step 1: Write the kubectl plugin using Golang; Step 2: Package the kubectl plugin to generate an executable binary file kubectl-pod-info; Step 3: Grant executable permissions to kubectl-pod-info and add it to global variables as follows:

[0082] Chmod+x kubectl-pod-info

[0083] Export PATH+$PATH: / path / to / kubectl-pod-info

[0084] The command that the above plugin can execute is: Kubectl pod-info <pod-name>The `-n namespaces` option allows for the aggregation of other complex commands. After installing the above plugins, you can use `Kubectl pod-info` to... <pod-name>Commands such as -n namespaces can be used to obtain the cluster attribute information of the cluster where the node is located. All information related to the pod location can be obtained through the commands in the above plugin, which can avoid many cumbersome steps to obtain cluster attribute information and container attribute information. Thus, this invention can improve the efficiency of information acquisition.

[0085] 206. Determine the location of the Pod to be located based on the container attribute information and cluster attribute information.

[0086] In this embodiment of the invention, after determining the container attribute information of each container in the pod and the cluster attribute information of the cluster where the node is located, it is necessary to locate the pod based on the container attribute information and the cluster attribute information. Based on this, step 206 specifically includes: determining the network interface card information and IP address information corresponding to the pod to be located based on the container attribute information and the cluster attribute information; and determining the location information of the pod to be located based on the network interface card information and IP address information corresponding to the pod to be located.

[0087] Specifically, by parsing container attribute information (container quantity, IP address, tag information, port information, replica quantity, container image name, port protocol type, network interface information, etc.) and cluster attribute information (number of nodes in the cluster, cluster type, pod tags and number of pods running in the cluster, etc.), the network interface information and IP address of the pod to be located can be determined. Finally, based on the pod's network interface information and IP address, the pod's network link can be determined, and the pod's location can be achieved based on the pod's network link. Thus, by determining the pod's cluster through the Node node where the pod resides, and determining the cluster's attribute information, it is also necessary to determine the container attribute information corresponding to each container within the pod. Finally, based on the cluster attribute information and container attribute information, the pod is located. In the process of pod location, a comprehensive analysis of all information related to the pod's location can improve the accuracy of pod location.

[0088] According to another Pod location method provided by the present invention, compared with the current method of locating Pods solely based on the location of the Node to which the Pod is bound, the present invention obtains the Node corresponding to the Pod to be located, and obtains the container attribute information corresponding to each container in the Pod to be located; and determines the cluster where the Node is located in a preset cluster configuration table based on the Node identifier corresponding to the Node, wherein the preset cluster configuration table stores clusters corresponding to different standard Node image identifiers and clusters corresponding to different standard Node character identifiers; then determines the cluster attribute information of the cluster where the Node is located; finally, the location information of the Pod to be located is determined based on the container attribute information and the cluster attribute information. Thus, the cluster where the Pod is located is determined by the Node where the Pod is located, and the cluster attribute information of the cluster where the Pod is located is determined. At the same time, the container attribute information corresponding to each container in the Pod also needs to be determined. Finally, the Pod is located based on the cluster attribute information and the container attribute information. In the process of Pod location, by comprehensively analyzing all information related to the Pod's location, the Pod location accuracy can be improved.

[0089] Furthermore, as Figure 1 In specific implementation, embodiments of the present invention provide a Pod location device, such as... Figure 3 As shown, the device includes: an acquisition unit 31, a first determination unit 32, a second determination unit 33, and a positioning unit 34.

[0090] The acquisition unit 31 can be used to acquire the Node corresponding to the Pod to be located, and to acquire the container attribute information corresponding to each container in the Pod to be located.

[0091] The first determining unit 32 can be used to determine the cluster where the Node belongs in a preset cluster configuration table based on the Node identifier corresponding to the Node. The preset cluster configuration table stores clusters corresponding to different standard Node image identifiers and clusters corresponding to different standard Node character identifiers.

[0092] The second determining unit 33 can be used to determine the cluster attribute information of the cluster to which the Node node is located.

[0093] The positioning unit 34 can be used to determine the location information of the Pod to be located based on the container attribute information and the cluster attribute information.

[0094] In specific application scenarios, in order to obtain the Node corresponding to the Pod to be located, such as Figure 4 As shown, the acquisition unit 31 includes a first determining module 311, an acquisition module 312, and a parsing module 313.

[0095] The first determining module 311 can be used to determine the information acquisition interface corresponding to the Pod to be located.

[0096] The acquisition module 312 can be used to acquire the Node field in the information acquisition interface using a preset information acquisition function.

[0097] The parsing module 313 can be used to parse the Node field to obtain the Node corresponding to the Pod to be located.

[0098] In specific application scenarios, in order to obtain the container attribute information corresponding to each container in the Pod to be located, the acquisition module 312 can also be used to obtain the container quantity information, IP address information, tag information, port information, replica quantity information, container image name, port protocol type, and network card information corresponding to each container in the Pod to be located.

[0099] In specific application scenarios, in order to determine the cluster where the Node is located, the first determining unit 32 includes a judging module 321 and a second determining module 322.

[0100] The judgment module 321 can be used to determine the identifier type to which the Node identifier belongs.

[0101] The second determining module 322 can be used to determine the cluster where the Node is located in the preset cluster configuration table if the identifier type is a Node image identifier.

[0102] The second determining module 322 can also be used to determine the cluster where the Node is located in the preset cluster configuration table if the identifier type is a Node character identifier, using a character similarity matching algorithm.

[0103] In specific application scenarios, in order to determine the cluster where the Node is located, the second determining module 322 includes a determining submodule and a computing submodule.

[0104] The determining submodule can be used to determine the first image feature vector corresponding to the Node image identifier, and to determine the second image feature vector corresponding to each standard Node image identifier in the preset cluster configuration table.

[0105] The calculation submodule can be used to calculate the cosine similarity between the Node image identifier and each standard Node image identifier based on the first image feature vector and the second image feature vector.

[0106] Specifically, the determining submodule can be used to determine the maximum cosine similarity among the cosine similarities, determine the target standard Node image identifier corresponding to the maximum cosine similarity, and determine the cluster corresponding to the target standard Node image identifier as the cluster where the Node is located.

[0107] In specific application scenarios, in order to determine the cluster where the Node is located, the second determining module 322 also includes a segmentation module and a matching sub-module.

[0108] The segmentation module can be used to segment the Node character identifier and each standard Node character identifier in units of preset character length, to obtain at least one first segmented string corresponding to the Node character identifier and at least one second segmented string corresponding to each standard Node character identifier.

[0109] The matching submodule can be used to match the first segmented string with each of the second segmented strings to obtain the matching result.

[0110] The determining submodule can also be used to determine the target standard Node character identifier corresponding to the second segmented string with the most matching characters in the matching result, and determine the cluster corresponding to the target standard Node character identifier as the cluster where the Node is located.

[0111] In specific application scenarios, in order to determine the location information of the Pod to be located, the positioning unit 34 includes a third determining module 341 and a positioning module 342.

[0112] The third determining module 341 can be used to determine the network interface card information and IP address information corresponding to the Pod to be located based on the container attribute information and the cluster attribute information.

[0113] The positioning module 342 can be used to determine the location information of the Pod to be located based on the network card information and IP address information corresponding to the Pod to be located.

[0114] It should be noted that other corresponding descriptions of the functional modules involved in the Pod positioning device provided in this embodiment of the invention can be found in [reference]. Figure 1 The corresponding description of the method shown will not be repeated here.

[0115] Based on the above, Figure 1 Accordingly, this embodiment of the invention also provides a computer-readable storage medium storing a computer program that, when executed by a processor, performs the following steps: obtaining the Node corresponding to the Pod to be located, and obtaining container attribute information corresponding to each container in the Pod to be located; determining the cluster where the Node is located in a preset cluster configuration table based on the Node identifier corresponding to the Node, wherein the preset cluster configuration table stores clusters corresponding to different standard Node image identifiers and clusters corresponding to different standard Node character identifiers; determining the cluster attribute information of the cluster where the Node is located; and determining the location information of the Pod to be located based on the container attribute information and the cluster attribute information.

[0116] Based on the above, Figure 1 The method shown and as Figure 3 The embodiment of the device shown in the invention also provides a physical structure diagram of a computer device, such as... Figure 5 As shown, the computer device includes: a processor 41, a memory 42, and a computer program stored on the memory 42 and executable on the processor. Both the memory 42 and the processor 41 are mounted on a bus 43. When the processor 41 executes the program, it performs the following steps: obtaining the Node corresponding to the Pod to be located, and obtaining the container attribute information corresponding to each container in the Pod to be located; determining the cluster where the Node belongs in a preset cluster configuration table based on the Node identifier corresponding to the Node, wherein the preset cluster configuration table stores clusters corresponding to different standard Node image identifiers and clusters corresponding to different standard Node character identifiers; determining the cluster attribute information of the cluster where the Node belongs; and determining the location information of the Pod to be located based on the container attribute information and the cluster attribute information.

[0117] The present invention obtains the Node corresponding to the Pod to be located, and the container attribute information corresponding to each container in the Pod to be located; and determines the cluster where the Node is located in a preset cluster configuration table according to the Node identifier corresponding to the Node. The preset cluster configuration table stores clusters corresponding to different standard Node image identifiers and clusters corresponding to different standard Node character identifiers; then determines the cluster attribute information of the cluster where the Node is located; finally, the location information of the Pod to be located is determined according to the container attribute information and the cluster attribute information. Thus, the cluster where the Pod is located is determined by the Node where the Pod is located, and the cluster attribute information of the cluster where the Pod is located is determined. At the same time, the container attribute information corresponding to each container in the Pod is also determined. Finally, the Pod is located according to the cluster attribute information and the container attribute information. In the process of locating the Pod, the accuracy of Pod location can be improved by comprehensively analyzing all information related to the Pod's location.

[0118] It is obvious to those skilled in the art that the modules or steps of the present invention described above can be implemented using general-purpose computing devices. They can be centralized on a single computing device or distributed across a network of multiple computing devices. Optionally, they can be implemented using computer-executable program code, thereby storing them in a storage device for execution by a computing device. In some cases, the steps shown or described can be performed in a different order than those presented herein, or they can be fabricated as separate integrated circuit modules, or multiple modules or steps can be fabricated as a single integrated circuit module. Thus, the present invention is not limited to any particular combination of hardware and software.

[0119] The above description is merely a preferred embodiment of the present invention and is not intended to limit the invention. Various modifications and variations can be made to the present invention by those skilled in the art. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the present invention should be included within the scope of protection of the present invention.

Claims

1. A Pod location method, characterized in that, include: The `kubectl describe pod podname -n namespaces` command in the kubectl plugin can be used to obtain the Node node corresponding to the Pod to be located and the container attribute information corresponding to each container in the Pod to be located. The container attribute information includes: container quantity information, IP address information, tag information, port information, replica quantity information, container name, container image name, port protocol type, and network interface information. Based on the Node identifier corresponding to the Node, the cluster to which the Node belongs is determined in a preset cluster configuration table. The preset cluster configuration table stores clusters corresponding to different standard Node image identifiers and clusters corresponding to different standard Node character identifiers. Determine the cluster attribute information of the cluster where the Node node is located, wherein the cluster attribute information includes: the number of Node nodes in the cluster, the cluster category, the Pod tag and the number of Pods running in the cluster; The network interface card (NIC) information and IP address of the Pod to be located are obtained by parsing the container attribute information and the cluster attribute information. The network link is determined based on the NIC information and IP address of the Pod to be located, and the location information of the Pod to be located is determined based on the network link.

2. The method according to claim 1, characterized in that, The step of obtaining the Node corresponding to the Pod to be located includes: Determine the information acquisition interface corresponding to the Pod to be located; The Node field is obtained from the information acquisition interface using a preset information acquisition function; The Node field is parsed to obtain the Node corresponding to the Pod to be located.

3. The method according to claim 1, characterized in that, Obtain the container attribute information corresponding to each container in the Pod to be located, including: Obtain the container quantity information, IP address information, tag information, port information, replica quantity information, container image name, port protocol type, and network interface information for each container in the Pod to be located.

4. The method according to claim 1, characterized in that, The step of determining the cluster to which the Node belongs in a preset cluster configuration table based on the Node identifier corresponding to the Node includes: Determine the identifier type to which the Node identifier belongs; If the identifier type is a Node image identifier, then the cluster where the Node belongs is determined in the preset cluster configuration table using an image similarity matching algorithm; If the identifier type is a Node character identifier, then the cluster where the Node belongs is determined in the preset cluster configuration table using a character similarity matching algorithm.

5. The method according to claim 4, characterized in that, The step of using an image similarity matching algorithm to determine the cluster to which the Node belongs in the preset cluster configuration table includes: Determine the first image feature vector corresponding to the Node image identifier, and determine the second image feature vector corresponding to each standard Node image identifier in the preset cluster configuration table; Based on the first image feature vector and the second image feature vector, calculate the cosine similarity between the Node image identifier and each standard Node image identifier; Among the cosine similarities, the maximum cosine similarity is determined, and the target standard Node image identifier corresponding to the maximum cosine similarity is determined. The cluster corresponding to the target standard Node image identifier is determined as the cluster where the Node is located.

6. The method according to claim 4, characterized in that, The step of using a character similarity matching algorithm to determine the cluster to which the Node belongs in the preset cluster configuration table includes: Using a preset character length as the unit, the Node character identifier and each standard Node character identifier are segmented to obtain at least one first segmented string corresponding to the Node character identifier and at least one second segmented string corresponding to each standard Node character identifier; The first segmented string is matched with each of the second segmented strings to obtain the matching results; Determine the target standard Node character identifier corresponding to the second segment string with the most matching characters in the matching results, and determine the cluster corresponding to the target standard Node character identifier as the cluster where the Node is located.

7. The method according to claim 1, characterized in that, The method further includes: Based on the container attribute information and the cluster attribute information, determine the network interface information and IP address information corresponding to the Pod to be located; The location of the Pod to be located is determined based on the network card information and IP address information corresponding to the Pod to be located.

8. A Pod positioning device, characterized in that, include: The acquisition unit is used to obtain the Node corresponding to the Pod to be located through the kubectl describe pod name -n namespaces command in the kubectl plugin, and to obtain the container attribute information corresponding to each container in the Pod to be located. The container attribute information includes: container quantity information, IP address information, tag information, port information, replica quantity information, container name, container image name, port protocol type, and network interface information. The first determining unit is used to determine the cluster to which the Node belongs in a preset cluster configuration table based on the Node identifier corresponding to the Node. The preset cluster configuration table stores clusters corresponding to different standard Node image identifiers and clusters corresponding to different standard Node character identifiers. The second determining unit is used to determine the cluster attribute information of the cluster where the Node node is located, wherein the cluster attribute information includes: the number of Node nodes in the cluster, the cluster category, the Pod tag and the number of Pods running in the cluster; The positioning unit is used to parse the container attribute information and the cluster attribute information to obtain the network card information and IP address of the Pod to be located, determine the network link based on the network card information and IP address of the Pod to be located, and determine the location information of the Pod to be located based on the network link.

9. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the steps of the method according to any one of claims 1 to 7.

10. A computer device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the computer program is executed by a processor, it implements the steps of the method according to any one of claims 1 to 7.