CN112631727A - Method and device for monitoring pod - Google Patents

Method and device for monitoring pod Download PDF

Info

Publication number
CN112631727A
CN112631727A CN202011569134.7A CN202011569134A CN112631727A CN 112631727 A CN112631727 A CN 112631727A CN 202011569134 A CN202011569134 A CN 202011569134A CN 112631727 A CN112631727 A CN 112631727A
Authority
CN
China
Prior art keywords
pod
hash value
identifier
mapping
mapping relationship
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN202011569134.7A
Other languages
Chinese (zh)
Other versions
CN112631727B (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.)
Agricultural Bank of China
Original Assignee
Agricultural Bank of China
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 Agricultural Bank of China filed Critical Agricultural Bank of China
Priority to CN202011569134.7A priority Critical patent/CN112631727B/en
Publication of CN112631727A publication Critical patent/CN112631727A/en
Application granted granted Critical
Publication of CN112631727B publication Critical patent/CN112631727B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/455Emulation; Interpretation; Software simulation, e.g. virtualisation or emulation of application or operating system execution engines
    • G06F9/45533Hypervisors; Virtual machine monitors
    • G06F9/45558Hypervisor-specific management and integration aspects
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/455Emulation; Interpretation; Software simulation, e.g. virtualisation or emulation of application or operating system execution engines
    • G06F9/45533Hypervisors; Virtual machine monitors
    • G06F9/45558Hypervisor-specific management and integration aspects
    • G06F2009/45591Monitoring or debugging support

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Storage Device Security (AREA)
  • Debugging And Monitoring (AREA)

Abstract

The application discloses a method and a device for monitoring a container group pod. The method comprises the following steps: obtaining a hash value of a first container group pod; generating an identifier of the first pod according to the hash value of the first pod; establishing a first mapping relation between the hash value of the first pod and the identifier of the first pod; and if the first pod is abnormal and a newly added second pod exists, determining a second mapping relation according to the hash value of the first pod and the hash value of the second pod so that the monitoring center monitors the second pod through the second mapping relation. Therefore, the monitoring center can monitor the newly added pod in time through the second mapping relation.

Description

Method and device for monitoring pod
Technical Field
The present application relates to the field of computer technologies, and in particular, to a method and an apparatus for monitoring a pod.
Background
On the basis of the application container engine technology, the container cluster management system can provide functions of deployment operation, resource scheduling, service discovery, dynamic expansion and the like for containerized applications, and further improves convenience of large-scale cluster management.
kubernets is a container cluster management system, abbreviated as k8 s. k8s is divided into stateful k8s and stateless k8 s. The numbering of pod group pod instances running in state k8s is an ordered number, and when the number of pod instances needs to be adjusted, state k8s can only increment or decrement one pod instance at a time. While the number of pod instances running in stateless k8s is a randomly generated hash value, stateless k8s may increase or decrease multiple pod instances simultaneously. Therefore, compared to the stateful k8s, the stateless k8s in the stateless k8s can scale up the capacity quickly.
When the pod instance running in the stateless k8s is abnormal, the stateless k8s will clear the abnormal pod instance and create a new pod instance, the number of the new pod instance is the newly generated random hash value, and in addition, the application on k8s will restart the pod each time the deployer is replaced, and the number of the pod will also regenerate the new random hash value. For an external monitoring center, a worker is required to record a hash value corresponding to a new pod instance and record the hash value into the monitoring center, the monitoring center can monitor the new pod instance, and meanwhile, the worker is required to delete an overdue hash value caused by abnormal operation or restart of the pod in the monitoring center, so that the number of pods actually operated in production is ensured to be seen by the monitoring center, and if the overdue pod hash values are not deleted, the number of pods seen by the monitoring center in each pod restart every time is doubled, so that the workload of the worker is increased. Further, when the worker operates the lengthy random hash value, the worker may erroneously read the hash value, which may cause an operation error.
Therefore, it takes a long time for the staff to enter the number of the new pod into the monitoring center, and the monitoring center cannot timely monitor the new pod.
Disclosure of Invention
In order to solve the technical problem, the application provides a method and a device for monitoring a pod group pod, the method establishes a mapping relationship between a hash value of the pod group pod and an identifier of the pod, and further can uniquely determine the hash value of the pod through the identifier of the pod, and for an external monitoring center, a newly added pod can be monitored in time.
The embodiment of the application discloses the following technical scheme:
in a first aspect, the present application provides a method for monitoring a group of containers pod, comprising:
obtaining a hash value of a first container group pod;
generating an identifier of the first pod according to the hash value of the first pod;
establishing a first mapping relation between the hash value of the first pod and the identifier of the first pod;
and if the first pod is abnormal and a newly added second pod exists, determining a second mapping relation according to the hash value of the first pod and the hash value of the second pod so that the monitoring center monitors the second pod through the second mapping relation.
Optionally, the generating an identifier of the first pod according to the hash value of the first pod includes:
determining first ordering information of the hash value of the first pod according to a first preset ordering rule;
and generating an identifier of the first pod according to the first sequencing information.
Optionally, the determining a second mapping relationship according to the hash value of the first pod and the hash value of the second pod includes:
determining the identifier of the first pod corresponding to the hash value of the first pod according to the first mapping relation;
and determining a second mapping relation according to the hash value of the second pod and the identifier of the first pod.
Optionally, the determining a second mapping relationship according to the hash value of the second pod and the identifier of the first pod includes:
establishing a third mapping relation between the hash value of the second pod and the identifier of the first pod;
and updating the first mapping relation according to the third mapping relation to generate a second mapping relation.
Optionally, the determining a second mapping relationship according to the hash value of the first pod and the hash value of the second pod includes:
determining second sorting information of the hash value of the second pod according to a second preset sorting rule;
generating an identifier of the second pod according to the second sequencing information;
establishing a second mapping relationship between the hash value of the second pod and the identifier of the second pod.
Optionally, the obtaining the hash value of the first container group pod includes:
the hash value of the first container group pod is obtained through the application programming interface API.
In a second aspect, the present application provides a device for monitoring a group of containers pod, comprising: the device comprises an acquisition module, a mapping module and an updating module;
the obtaining module is used for obtaining the hash value of the first container group pod; generating an identifier of the first pod according to the hash value of the first pod;
the mapping module is used for establishing a first mapping relation between the hash value of the first pod and the identifier of the first pod;
and the updating module is used for determining a second mapping relation according to the hash value of the first pod and the hash value of the second pod if the first pod is abnormal and a newly added second pod exists, so that the monitoring center monitors the second pod through the second mapping relation.
Optionally, the obtaining module is specifically configured to determine, according to a first preset sorting rule, first sorting information of the hash value of the first pod; generating an identifier of the first pod according to the first ordering information
Optionally, the updating module is specifically configured to determine, according to the first mapping relationship, an identifier of the first pod corresponding to the hash value of the first pod; and determining a second mapping relation according to the hash value of the second pod and the identifier of the first pod.
Optionally, the mapping module is specifically configured to establish a third mapping relationship between the hash value of the second pod and the identifier of the first pod;
the updating module is specifically configured to update the first mapping relationship according to the third mapping relationship to generate a second mapping relationship.
Optionally, the obtaining module is specifically configured to determine, according to a second preset sorting rule, second sorting information of the hash value of the second pod; generating an identifier of the second pod according to the second sequencing information;
the mapping module is specifically configured to establish a second mapping relationship between the hash value of the second pod and the identifier of the second pod.
Optionally, the obtaining module is specifically configured to obtain the hash value of the first container group pod through an application programming interface API.
In a third aspect, the present application provides an seeking processing device, including:
a memory for storing a computer program and transmitting the computer program to the processor;
a processor for performing the method for monitoring a group of containers according to any of the above first aspects in accordance with instructions in the computer program.
In a fourth aspect, the present application provides a computer-readable storage medium for storing computer software instructions which, when run on a computer, cause the computer to perform the method for monitoring a group of containers of any one of the above first aspects.
According to the technical scheme, the method has the following advantages:
the application provides a method and a device for monitoring a container group pod. The method establishes the mapping relation between the hash value of the pod of the container group and the identification of the pod, and further can uniquely determine the hash value of the pod through the identification of the pod. Therefore, when the first pod in the pod list is abnormal and a newly added second pod exists, the method updates the mapping relationship, namely, the second mapping relationship is determined according to the hash value of the first pod and the hash value of the second pod, so that a worker does not need to record and record the hash value of the second pod into the monitoring center, the monitoring center can monitor the second pod through the updated mapping relationship, and the time required by the monitoring center to monitor the second pod is shortened. Thus, the monitoring center can monitor the second pod in a timely manner.
Drawings
In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required to be used in the description of the embodiments or the prior art will be briefly introduced below, the drawings in the following description are only some embodiments of the present application, and other drawings can be obtained by those skilled in the art without creative efforts.
Fig. 1 is a schematic diagram of a numbering system according to an embodiment of the present disclosure;
fig. 2 is a flowchart of a method for monitoring a pod according to an embodiment of the present disclosure;
FIG. 3 is a block diagram of a k8s according to an embodiment of the present disclosure;
fig. 4 is a schematic diagram of a pod monitoring apparatus according to an embodiment of the present disclosure;
fig. 5 is a schematic diagram of a computing device according to an embodiment of the present application.
Detailed Description
In order to make the technical solutions of the present application better understood, 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.
For ease of understanding, the technical terms referred to in the present application are described below.
The set of containers pod is a combination of one or more associated containers. Containers within a pod run on the same host, using the same network namespace, IP address and port. The pod is the smallest unit created, scheduled, and managed by the container cluster management system, enabling more flexibility in containerized application deployment and management.
kubernets is a container cluster management system, abbreviated as k8 s. k8s is divided into stateful k8s and stateless k8 s. The numbers of pod instances running in the stateful k8s are ordered numbers, and when the number of pod instances needs to be adjusted, the stateful k8s can only increase or decrease one pod instance at a time, and cannot increase multiple pod instances at the same time. While the number of pod instances running in stateless k8s is a hash value, stateless k8s can increase or decrease multiple pod instances at a time when the number of pod instances needs to be adjusted. It can be seen that stateless k8s can scale up quickly.
However, the number of the pod instance running in stateless k8s is a hash value, and the hash value needs to be monitored for an external monitoring center. When the pod instance running in the stateless k8s is abnormal, the stateless k8s clears the abnormal pod instance and creates a new pod instance, which is numbered as a randomly generated hash value. In order to enable the monitoring center to monitor the new pod, a staff member is required to record the number of the new pod instance and enter the number into the monitoring center. This process takes a long time, which in turn results in the monitoring center not being able to monitor the new pod in a timely manner.
In view of the above, the present application provides a method for monitoring a pod. The method may be implemented by a numbering system. Specifically, the numbering system acquires the hash value of the first pod, generates the identifier of the first pod according to the hash value of the first pod, and establishes a first mapping relationship between the hash value of the first pod and the identifier of the first pod. If the first pod is abnormal and a newly added second pod exists, the numbering system determines a second mapping relation according to the hash value of the first pod and the hash value of the second pod. Thus, the monitoring center can monitor the new second pod through the second mapping relationship.
In one aspect, the method establishes a mapping relationship between the hash value of the pod and the identification of the pod, i.e., each pod identification uniquely corresponds to the hash value of the pod. For internal k8s, when the first pod running in k8s is abnormal, k8s will clear the first pod and create a second pod, and randomly generate a hash value for the second pod. The method updates the original mapping relation according to the hash value of the first pod and the hash value of the second pod to generate a new mapping relation. For the external monitoring center, the staff is not required to record the hash value of the second pod again and then enter the hash value into the monitoring center. And the monitoring center monitors the identification of the pod according to the updated mapping relation, so that the monitoring of the pod can be realized. Thus, when the pod operating in the stateless k8s is abnormal and there is a newly added pod, the monitoring center can monitor the newly added pod in time. On the other hand, on the premise that the monitoring center can be well connected, the method still has the advantages that stateless k8s can be rapidly expanded and shrunk, and the like.
This numbering system may be applied to stateless k8 s. For example, the numbering system can obtain the hash value of the pod running in stateless k8s, and establish a mapping between the hash value of the pod and the identity of the pod. After the monitoring center is in butt joint, the monitoring center can monitor the pod according to the mapping relation.
The numbering system may be deployed in a computing device in the form of computer software to implement the numbering functions. In some embodiments, the numbering system may also be a hardware system comprising a physical device with numbering functionality.
Next, a system architecture of the numbering system is explained, and as shown in fig. 1, the numbering system 100 includes an obtaining unit 102, a mapping unit 104, and an updating unit 106. The obtaining unit 102 is configured to obtain a hash value of the first pod, and generate an identifier of the first pod according to the hash value of the first pod. In some implementations, the obtaining unit 102 obtains the hash value of the first pod through an application programming interface API. The mapping unit 104 is configured to establish a first mapping relationship between the hash value of the first pod and the identifier of the first pod. If the first pod is abnormal and a second pod is newly added, the updating unit 106 determines a second mapping relationship according to the hash value of the first pod and the hash value of the second pod. And the monitoring center monitors the second pod through the second mapping relation.
The mapping unit 104 can establish a mapping relationship according to the hash value of the pod and the identification of the pod. When a certain pod (e.g., the first pod) running in stateless k8s is abnormal, stateless k8s creates a new pod (e.g., the second pod). The updating unit 106 can update the original mapping relationship according to the hash value of the first pod and the hash value of the second pod. Thus, the monitoring center can monitor the second pod according to the updated mapping relationship. It is understood that the monitoring center can also monitor other pod according to the updated mapping relationship.
In some implementations, the obtaining unit 102 can generate the identification of the first pod according to the ranking information of the hash value of the first pod. Specifically, the obtaining unit 102 determines first sorting information of the hash value of the first pod according to a first preset sorting rule, and generates an identifier of the first pod according to the first sorting information. For example: taking the example that the pod running in stateless k8s includes the first pod, the third pod, and the fourth pod, the hash value of the first pod is "13312", the hash value of the third pod is "23313", and the hash value of the fourth pod is "34213". The first preset sort rule may be a small-to-large sort, whereby the obtaining unit 102 can obtain the arrangement order of the hash value of the first pod, the hash value of the third pod, and the hash value of the fourth pod, i.e., [ the hash value of the first pod, the hash value of the third pod, the hash value of the fourth pod ]. The order of the hash value of the first pod is first, and the obtaining unit 102 generates the identifier of the first pod according to the first order information of the hash value of the first pod, for example, the identifier of the first pod may be "01". Similarly, the obtaining unit 102 can generate the identifier "02" of the third pod and the identifier "03" of the fourth pod.
The numbering system 100 determines the second mapping relationship according to the hash value of the first pod and the hash value of the second pod in the following two ways, which are described below by taking the pod operating in the above stateless k8s as an example, including the first pod, the third pod and the fourth pod.
The first method comprises the following steps:
when the first pod is abnormal, stateless k8s creates a new second pod, a randomly generated hash value for the second pod. To ensure that the monitoring center can monitor the second pod, the updating unit 106 updates the mapping relationship between the hash value of the first pod and the identifier of the first pod, and associates the identifier of the first pod with the hash value of the second pod. In this manner, the monitoring center can monitor the second pod via the identity of the first pod.
Specifically, the updating unit 106 determines the identifier of the first pod corresponding to the hash value of the first pod according to the first mapping relationship, and establishes a second mapping relationship according to the hash value of the second pod and the identifier of the first pod. That is, the updating unit 106 updates the first mapping relationship to the second mapping relationship, and the monitoring center can monitor the second pod through the second mapping relationship. Of course, the monitoring center may also monitor other pods, such as the third pod and the fourth pod, through the second mapping relationship. In some implementations, the mapping unit 104 establishes a third mapping relationship between the hash value of the second pod and the identity of the first pod, the third mapping relationship being that the identity of the first pod corresponds to the hash value of the second pod. The updating unit 106 updates the first mapping relationship according to the third mapping relationship, that is, the hash value of the first pod corresponding to the identifier of the first pod in the first mapping relationship is updated to the hash value of the second pod, so as to obtain the second mapping relationship.
In this way, the numbering system 100 only needs to correspond the hash value of the newly added pod to the identification of the abnormal pod, and the monitoring center can monitor the newly added pod through the identification of the abnormal pod. The numbering system 100 only modifies the mapping relationship of one pod, so that the time for modifying the mapping relationship is reduced, and the monitoring center can monitor the newly added pod in a short time.
And the second method comprises the following steps:
when the first pod is abnormal, stateless k8s creates a new second pod, a randomly generated hash value for the second pod. In the second, the numbering system 100 re-orders according to the hash value of the second pod, the hash value of the third pod, and the hash value of the fourth pod, generates identifiers respectively, and finally re-establishes the mapping relationship.
Specifically, the obtaining unit 102 determines second sorting information of the hash value of the second pod according to a second preset sorting rule, and generates an identifier of the second pod according to the second sorting information. The mapping unit 104 establishes a second mapping relationship between the hash value of the second pod and the identification of the second pod.
The second predetermined ordering rule may be the same as or different from the first predetermined ordering rule. Taking the second preset rule being the same as the first preset rule and the hash value of the second pod being "47621" as an example, the obtaining unit 102 can obtain the arrangement order of the hash value of the second pod, the hash value of the third pod and the hash value of the fourth pod, i.e., [ the hash value of the third pod, the hash value of the fourth pod, the hash value of the second pod ]. The order of the hash value of the second pod is third, and the obtaining unit 102 generates the identifier "03" of the second pod according to the second sorting information of the hash value of the second pod. Similarly, the third pod is identified as "01" and the second pod is identified as "02". The mapping unit 104 then establishes a second mapping relationship between the identification of the pod and the hash value of the pod according to the new identification. The second mapping relationship comprises the corresponding relationship between the hash value of the newly added second pod and the identifier of the second pod.
Thus, the numbering system 100 re-establishes a mapping between the hash value of the pod and the identification of the pod for the pod running in k8 s. The monitoring center can monitor the newly added pod in time through the reestablished mapping relation. Of course, the monitoring center can also monitor other pods, such as the third pod and the fourth pod.
In order to make the technical solution of the present application clearer and easier to understand, the following describes in detail a method for monitoring a pod provided in the embodiments of the present application from the perspective of the numbering system 100.
Referring to fig. 2, the figure is a flowchart of a method for monitoring a pod according to an embodiment of the present application, where the method includes:
s202: the numbering system 100 obtains the hash value of the first pod.
Referring to fig. 3, the architecture diagram of k8s according to the embodiment of the present application is shown. k8s creates a pod from the master and node. The master is the management node of k8s for providing the resource data access entries and cluster control entries of the cluster. The node is a unit operated by k8s, is used for carrying and distributing the pod operation, and is a host of the pod operation.
Specifically, the master includes etcd, api server, controller manager, and scheduler. The etcd is a service discovery and storage service with high availability and strong consistency, saves the state of the whole cluster, and maintains a list of the pod. The api server provides access to resource operations, and provides authentication, authorization, access control, api registration and discovery, and the like. The controller manager is responsible for maintaining the state of the cluster, for example: fault detection, field expansion, rolling updates, etc. The Scheduler is responsible for scheduling resources and scheduling the pod to the corresponding machine according to a predetermined scheduling strategy. Node includes kubelet and docker. Wherein, kubelet is responsible for maintaining the lifecycle of the pod, and docker is responsible for the creation and management of the native pod.
As can be seen from the architecture of k8s, the numbering system 100 can access the etcd through the api server, and further obtain the list of the pod, which includes the hash value of the pod. Thereby, the numbering system 100 can acquire the hash value of the pod. And the list of pods includes the first pod, the numbering system 100 can obtain the hash value of the first pod.
S204: the numbering system 100 generates an identification of the first pod from the hash value of the first pod.
Considering that the hash value of the external pod is a randomly generated value of k8s, for the external monitoring center, every time a new pod is added to k8s, a worker is required to record the hash value of the new pod into the monitoring center, and the monitoring center cannot monitor the new pod in time. To this end, the numbering system 100 generates an identification of the pod from the hash value of the pod, the hash value of the pod having a unique corresponding relationship with the identification of the pod. For example, the numbering system 100 generates an identification of the first pod from the hash value of the first pod, the identification of the first pod uniquely corresponding to the hash value of the first pod.
In some implementations, the numbering system 100 determines first ordering information of the hash value of the first pod according to a first preset ordering rule, and generates the identifier of the first pod according to the first ordering information. For example, the pod running in k8s includes a first pod, a third pod, and a fourth pod, for example, the hash value of the first pod is "13312", the hash value of the third pod is "23313", and the hash value of the fourth pod is "34213". The first preset sort rule may be a small-to-large sort, whereby the numbering system 100 is able to get the order of the hash value of the first pod, the hash value of the third pod, and the hash value of the fourth pod, i.e., [ the hash value of the first pod, the hash value of the third pod, the hash value of the fourth pod ]. The order of the hash value of the first pod is first, and the numbering system 100 generates an identification of the first pod from the first ordering information of the hash value of the first pod, e.g., the identification of the first pod may be "01". Similarly, the numbering system 100 can generate an identification "02" for the third pod and an identification "03" for the fourth pod.
S206: the numbering system 100 establishes a first mapping between the hash value of the first pod and the identification of the first pod.
After the numbering system 100 generates the identification of the pod according to the hash value of the pod, the numbering system 100 establishes a mapping relationship between the identification of the pod and the hash value of the pod. In particular, the numbering system 100 establishes a first mapping between the hash value of the first pod and the identity of the first pod. Therefore, the monitoring center monitors the first pod by monitoring the identification of the first pod according to the first mapping relation.
S208: if the first pod is abnormal and a new second pod exists, the numbering system 100 determines a second mapping relationship according to the hash value of the first pod and the hash value of the second pod, so that the monitoring center monitors the second pod through the second mapping relationship.
When the first pod is abnormal, k8s will create a second pod whose hash value is a randomly generated value. The numbering system 100 determines the second mapping relationship according to the hash value of the first pod and the hash value of the second pod in the following two ways, which are described below by taking the pod operating in the above stateless k8s as an example, including the first pod, the third pod and the fourth pod.
The first method comprises the following steps:
the numbering system 100 determines the identifier of the first pod corresponding to the hash value of the first pod according to the first mapping relationship, and establishes a second mapping relationship according to the hash value of the second pod and the identifier of the first pod. That is, the numbering system 100 updates the first mapping relationship to the second mapping relationship, and the monitoring center can monitor the second pod through the second mapping relationship. Of course, the monitoring center may also monitor other pods, such as the third pod and the fourth pod, through the second mapping relationship. In some implementations, the mapping unit 104 establishes a third mapping relationship between the hash value of the second pod and the identity of the first pod, the third mapping relationship being that the identity of the first pod corresponds to the hash value of the second pod. The numbering system 100 updates the first mapping relationship according to the third mapping relationship, that is, the hash value of the first pod corresponding to the identifier of the first pod in the first mapping relationship is updated to the hash value of the second pod, so as to obtain the second mapping relationship.
And the second method comprises the following steps:
the numbering system 100 determines second sorting information of the hash value of the second pod according to a second preset sorting rule, generates an identifier of the second pod according to the second sorting information, and establishes a second mapping relationship between the hash value of the second pod and the identifier of the second pod.
The second predetermined ordering rule may be the same as or different from the first predetermined ordering rule. Taking the second preset rule being the same as the first preset rule, and the hash value of the second pod being "47621", for example, the numbering system 100 can obtain the arrangement order of the hash value of the second pod, the hash value of the third pod, and the hash value of the fourth pod, i.e., [ the hash value of the third pod, the hash value of the fourth pod, the hash value of the second pod ]. The hash value of the second pod is in the third order, and the numbering system 100 generates an identification of the second pod as "03" based on the second ordering information of the hash value of the second pod. Similarly, the third pod is identified as "01" and the second pod is identified as "02". The numbering system 100 then establishes a second mapping relationship between the identification of the pod and the hash value of the pod based on the new identification. The second mapping relationship comprises the corresponding relationship between the hash value of the newly added second pod and the identifier of the second pod.
In this way, the monitoring center can monitor the newly added second pod through the second mapping relationship.
The monitoring method provided by the embodiment establishes the mapping relationship between the hash value of the pod in the container group and the identification of the pod, and further can uniquely determine the hash value of the pod through the identification of the pod. Therefore, when the first pod in the pod list is abnormal and a newly added second pod exists, the method updates the mapping relationship, namely, the second mapping relationship is determined according to the hash value of the first pod and the hash value of the second pod, so that a worker does not need to record and record the hash value of the second pod into the monitoring center, the monitoring center can monitor the second pod through the updated mapping relationship, and the time required by the monitoring center to monitor the second pod is shortened. Thus, the monitoring center can monitor the second pod in a timely manner.
The above describes the monitoring method of the container group provided in this embodiment, and the following describes the monitoring apparatus of the container group provided in this embodiment. Referring to fig. 4, which is a schematic diagram of a monitoring apparatus for a container group according to the present embodiment, the processing apparatus 400 includes: an acquisition module 401, a mapping module 402 and an update module 403.
The obtaining module 401 is configured to obtain a hash value of the first container group pod; generating an identifier of the first pod according to the hash value of the first pod;
the mapping module 402 is configured to establish a first mapping relationship between the hash value of the first pod and the identifier of the first pod;
the updating module 403 is configured to determine a second mapping relationship according to the hash value of the first pod and the hash value of the second pod if the first pod is abnormal and a second pod added newly exists, so that the monitoring center monitors the second pod through the second mapping relationship.
The monitoring means 400 of the above-described container group may be implemented by a computing device. Fig. 5 provides a computing device, and as shown in fig. 5, the computing device 500 may be specifically used to implement the functions of the monitoring apparatus 400 of the container group in the embodiment shown in fig. 4.
Computing device 500 includes a bus 501, a processor 502, and a memory 503. The processor 502 and the memory 503 communicate with each other via a bus 501.
The processor 502 may be any one or more of a Central Processing Unit (CPU), a Graphics Processing Unit (GPU), a Micro Processor (MP), a Digital Signal Processor (DSP), and the like.
The memory 503 may include a volatile memory (volatile memory), such as a Random Access Memory (RAM). The memory 503 may also include a non-volatile memory (non-volatile memory), such as a read-only memory (ROM), a flash memory, a hard drive (HDD) or a Solid State Drive (SSD).
The memory 503 stores executable program codes, and the processor 502 executes the executable program codes to perform the monitoring method of the aforementioned container group. Specifically, the processor 502 executes the program code, and the processor obtains the hash value of the first container group pod; generating an identifier of the first pod according to the hash value of the first pod; establishing a first mapping relation between the hash value of the first pod and the identifier of the first pod; and if the first pod is abnormal and a newly added second pod exists, determining a second mapping relation according to the hash value of the first pod and the hash value of the second pod so that the monitoring center monitors the second pod through the second mapping relation.
The embodiment of the application also provides a computer readable storage medium. The computer-readable storage medium can be any available medium that a computing device can store or a data storage device, such as a data center, that contains one or more available media. The usable medium may be a magnetic medium (e.g., floppy disk, hard disk, magnetic tape), an optical medium (e.g., DVD), or a semiconductor medium (e.g., solid state disk), among others. The computer-readable storage medium includes instructions that instruct a computing device to perform the method for monitoring a group of containers described above.
The embodiments in the present specification are described in a progressive manner, and the same and similar parts among the embodiments are referred to each other, and each embodiment focuses on the differences from the other embodiments. In particular, for the apparatus embodiment, since it is substantially similar to the method embodiment, it is relatively simple to describe, and reference may be made to some descriptions of the method embodiment for relevant points. The above-described apparatus embodiments are merely illustrative, and the units and modules described as separate components may or may not be physically separate. In addition, some or all of the units and modules may be selected according to actual needs to achieve the purpose of the solution of the embodiment. One of ordinary skill in the art can understand and implement it without inventive effort.
It should be understood that in the present application, "at least one" means one or more, "a plurality" means two or more. "and/or" for describing an association relationship of associated objects, indicating that there may be three relationships, e.g., "a and/or B" may indicate: only A, only B and both A and B are present, wherein A and B may be singular or plural. The character "/" generally indicates that the former and latter associated objects are in an "or" relationship. "at least one of the following" or similar expressions refer to any combination of these items, including any combination of single item(s) or plural items. For example, at least one (one) of a, b, or c, may represent: a, b, c, "a and b", "a and c", "b and c", or "a and b and c", wherein a, b, c may be single or plural.
The foregoing is merely a preferred embodiment of the present application and is not intended to limit the present application in any way. Although the present application has been described with reference to the preferred embodiments, it is not intended to limit the present application. Those skilled in the art can now make numerous possible variations and modifications to the disclosed embodiments, or modify equivalent embodiments, using the methods and techniques disclosed above, without departing from the scope of the claimed embodiments. Therefore, any simple modification, equivalent change and modification made to the above embodiments according to the technical essence of the present application still fall within the protection scope of the technical solution of the present application without departing from the content of the technical solution of the present application.

Claims (10)

1. A method of monitoring a group of containers pod, comprising:
obtaining a hash value of a first container group pod;
generating an identifier of the first pod according to the hash value of the first pod;
establishing a first mapping relation between the hash value of the first pod and the identifier of the first pod;
and if the first pod is abnormal and a newly added second pod exists, determining a second mapping relation according to the hash value of the first pod and the hash value of the second pod so that the monitoring center monitors the second pod through the second mapping relation.
2. The method of claim 1, wherein the generating the identification of the first pod from the hash value of the first pod comprises:
determining first ordering information of the hash value of the first pod according to a first preset ordering rule;
and generating an identifier of the first pod according to the first sequencing information.
3. The method of claim 1 or 2, wherein determining a second mapping from the hash value of the first pod and the hash value of the second pod comprises:
determining the identifier of the first pod corresponding to the hash value of the first pod according to the first mapping relation;
and determining a second mapping relation according to the hash value of the second pod and the identifier of the first pod.
4. The method of claim 3, wherein determining a second mapping from the hash value of the second pod and the identity of the first pod comprises:
establishing a third mapping relation between the hash value of the second pod and the identifier of the first pod;
and updating the first mapping relation according to the third mapping relation to generate a second mapping relation.
5. The method of claim 1 or 2, wherein determining a second mapping from the hash value of the first pod and the hash value of the second pod comprises:
determining second sorting information of the hash value of the second pod according to a second preset sorting rule;
generating an identifier of the second pod according to the second sequencing information;
establishing a second mapping relationship between the hash value of the second pod and the identifier of the second pod.
6. The method according to any of claims 1 to 5, wherein the obtaining the hash value of the first container group pod comprises:
the hash value of the first container group pod is obtained through the application programming interface API.
7. A device for monitoring a group of containers pod, comprising: the device comprises an acquisition module, a mapping module and an updating module;
the obtaining module is used for obtaining the hash value of the first container group pod; generating an identifier of the first pod according to the hash value of the first pod;
the mapping module is used for establishing a first mapping relation between the hash value of the first pod and the identifier of the first pod;
and the updating module is used for determining a second mapping relation according to the hash value of the first pod and the hash value of the second pod if the first pod is abnormal and a newly added second pod exists, so that the monitoring center monitors the second pod through the second mapping relation.
8. The apparatus according to claim 7, wherein the updating module is specifically configured to determine, according to the first mapping relationship, an identifier of the first pod corresponding to the hash value of the first pod; and determining a second mapping relation according to the hash value of the second pod and the identifier of the first pod.
9. The apparatus of claim 8, wherein the mapping module is specifically configured to establish a third mapping relationship between the hash value of the second pod and the identifier of the first pod;
the updating module is specifically configured to update the first mapping relationship according to the third mapping relationship to generate a second mapping relationship.
10. The apparatus according to claim 7, wherein the obtaining module is specifically configured to determine second sorting information of the hash value of the second pod according to a second preset sorting rule; generating an identifier of the second pod according to the second sequencing information;
the mapping module is specifically configured to establish a second mapping relationship between the hash value of the second pod and the identifier of the second pod.
CN202011569134.7A 2020-12-26 2020-12-26 Monitoring method and device for pod group pod Active CN112631727B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202011569134.7A CN112631727B (en) 2020-12-26 2020-12-26 Monitoring method and device for pod group pod

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202011569134.7A CN112631727B (en) 2020-12-26 2020-12-26 Monitoring method and device for pod group pod

Publications (2)

Publication Number Publication Date
CN112631727A true CN112631727A (en) 2021-04-09
CN112631727B CN112631727B (en) 2024-02-23

Family

ID=75325204

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202011569134.7A Active CN112631727B (en) 2020-12-26 2020-12-26 Monitoring method and device for pod group pod

Country Status (1)

Country Link
CN (1) CN112631727B (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN118041701A (en) * 2024-04-12 2024-05-14 华信咨询设计研究院有限公司 Directional acquisition and early warning method and system based on container cloud micro-service access flow

Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20160285932A1 (en) * 2015-03-24 2016-09-29 Cisco Technology, Inc. Multicast traffic distribution in a multi-pod network environment
CN109101342A (en) * 2018-07-20 2018-12-28 北京百度网讯科技有限公司 Distributed job control method for coordinating, device, computer equipment and storage medium
CN110213309A (en) * 2018-03-13 2019-09-06 腾讯科技(深圳)有限公司 A kind of method, equipment and the storage medium of binding relationship management
CN110427249A (en) * 2019-07-26 2019-11-08 重庆紫光华山智安科技有限公司 Method for allocating tasks, pod initial method and relevant apparatus
CN111258609A (en) * 2020-01-19 2020-06-09 北京百度网讯科技有限公司 Upgrading method and device of Kubernetes cluster, electronic equipment and medium
CN111625418A (en) * 2020-05-12 2020-09-04 深圳前海微众银行股份有限公司 Process monitoring method and device
CN111966467A (en) * 2020-08-21 2020-11-20 苏州浪潮智能科技有限公司 Method and device for disaster recovery based on kubernetes container platform

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20160285932A1 (en) * 2015-03-24 2016-09-29 Cisco Technology, Inc. Multicast traffic distribution in a multi-pod network environment
CN110213309A (en) * 2018-03-13 2019-09-06 腾讯科技(深圳)有限公司 A kind of method, equipment and the storage medium of binding relationship management
CN109101342A (en) * 2018-07-20 2018-12-28 北京百度网讯科技有限公司 Distributed job control method for coordinating, device, computer equipment and storage medium
CN110427249A (en) * 2019-07-26 2019-11-08 重庆紫光华山智安科技有限公司 Method for allocating tasks, pod initial method and relevant apparatus
CN111258609A (en) * 2020-01-19 2020-06-09 北京百度网讯科技有限公司 Upgrading method and device of Kubernetes cluster, electronic equipment and medium
CN111625418A (en) * 2020-05-12 2020-09-04 深圳前海微众银行股份有限公司 Process monitoring method and device
CN111966467A (en) * 2020-08-21 2020-11-20 苏州浪潮智能科技有限公司 Method and device for disaster recovery based on kubernetes container platform

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN118041701A (en) * 2024-04-12 2024-05-14 华信咨询设计研究院有限公司 Directional acquisition and early warning method and system based on container cloud micro-service access flow

Also Published As

Publication number Publication date
CN112631727B (en) 2024-02-23

Similar Documents

Publication Publication Date Title
CN107391629B (en) Method, system, server and computer storage medium for data migration between clusters
CN112506659B (en) Management method of edge equipment and related device
EP3442201B1 (en) Cloud platform construction method and cloud platform
CN106933672B (en) Distributed environment coordinated consumption queue method and device
US10761869B2 (en) Cloud platform construction method and cloud platform storing image files in storage backend cluster according to image file type
CN107451147A (en) A kind of method and apparatus of kafka clusters switching at runtime
EP3432132B1 (en) Data storage method and device
CN110716787A (en) Container address setting method, apparatus, and computer-readable storage medium
CN105262835A (en) Data storage method and device of multiple machine rooms
CN107203429A (en) A kind of method and device that distributed task scheduling is loaded based on distributed lock
CN106790131B (en) Parameter modification method and device and distributed platform
CN111327651A (en) Resource downloading method, device, edge node and storage medium
CN108769118B (en) Method and device for selecting master nodes in distributed system
CN107391303B (en) Data processing method, device, system, server and computer storage medium
CN113315754A (en) Intelligent linkage method, device, equipment and medium for firewall of container visit
CN112579319A (en) Service calling method and device based on LRU Cache optimization
CN113438107A (en) Cluster node expansion method, device, equipment and storage medium
CN109951551B (en) Container mirror image management system and method
CN111352726B (en) Stream data processing method and device based on containerized micro-service
CN111008071A (en) Task scheduling system, method and server
CN112631727A (en) Method and device for monitoring pod
CN108228272B (en) WEB container generation processing method, equipment and server
CN111274004A (en) Process instance management method and device and computer storage medium
CN107547622B (en) Resource adjusting method and device
CN114416438A (en) Data export method and device, computer equipment and scheduling service 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