A Kubernetes resource monitoring method and system based on CMDB

Through the communication and event monitor between CMDB and Kubernetes API, dynamic discovery and real-time tracking of Kubernetes resources are realized, solving the problem that traditional monitoring methods cannot meet the real-time changes in cluster resources, and improving the sensitivity and real-time perception of resource management.

CN117851182BActive Publication Date: 2024-11-29GUANGZHOU ELECTRIC POWER COMM NETWORK LTD

Patent Information

Application Number
CN202410128934.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-01-30
Publication Date
2024-11-29
Estimated Expiration
2044-01-30

AI Technical Summary

Technical Problem

Traditional Kubernetes resource monitoring methods cannot meet the real-time requirements of dynamic changes in cluster resources, and cannot effectively realize automatic discovery and real-time tracking of resources.

Method used

By establishing communication between CMDB and Kubernetes API, resource information is obtained and interpreted, and the polling and event monitor mechanisms are used to realize dynamic discovery and real-time tracking of resources, and resource acquisition, labeling and monitor.

Benefits of technology

It improves sensitivity and real-time perception of dynamic changes in Kubernetes clusters, reduces the lag in resource management, and improves real-time, communication efficiency and user experience.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117851182B_ABST
    Figure CN117851182B_ABST
Patent Text Reader

Abstract

The present invention belongs to the field of computer technology, and provides a Kubernetes resource monitoring method and system based on CMDB. The method includes: establishing communication between CMDB and Kubernetes API, so that CMDB obtains, interprets and stores resource information returned by Kubernetes, polls Kubernetes API, compares the current polling result with the previous polling result, so that the newly added, deleted or updated resource information is reflected in CMDB, or / and, subscribes to Kubernetes resource change events in real time through event monitors and establishes an asynchronous update mechanism that enables CMDB to update corresponding resource information; collects Kubernetes resources, and based on Label tags or / and Annonation annotations, associates the collected resources with corresponding application and business system resources after application information marking; displays the collected resources in CMDB in a visual ledger form, and monitors Kubernetes; therefore, the present invention can solve the problem that traditional tracking mechanisms often cannot meet the real-time requirements of dynamic changes in Kubernetes cluster resources.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of computer technology, and in particular to a Kubernetes resource monitoring method and system based on CMDB. Background Art

[0002] With the widespread application of containerization technology, Kubernetes, as an open source container orchestration platform, provides a convenient solution for the deployment, expansion and management of applications. However, with it comes the high dynamics and complexity of resources, which makes traditional resource management and monitoring methods seem inadequate. In this context, faced with the demand for automatic discovery and real-time tracking of resources, it is necessary to solve how to effectively realize the automatic discovery and real-time tracking of Kubernetes API resources. Traditional tracking mechanisms often cannot meet the real-time requirements of dynamic changes in Kubernetes cluster resources. Summary of the invention

[0003] In view of the above technical problems, the present invention provides a Kubernetes resource monitoring method and system based on CMDB to solve the problem that the traditional tracking mechanism in the prior art often cannot meet the real-time requirements of dynamic changes in Kubernetes cluster resources.

[0004] Other features and advantages of the present invention will become apparent from the following detailed description, or may be learned in part by practice of the present invention.

[0005] According to one aspect of the present invention, a Kubernetes resource monitoring method based on CMDB is disclosed, the method comprising:

[0006] Establishing communication between the CMDB and the API of Kubernetes, so that the CMDB obtains, interprets, and stores resource information returned by Kubernetes in JSON format, polls the API of Kubernetes, and compares the current polling result with the previous polling result so that the newly added, deleted, or updated resource information is reflected in the CMDB, or / and subscribing to the resource change events of Kubernetes in real time through an event monitor and establishing an asynchronous update mechanism that enables the CMDB to update the corresponding resource information;

[0007] Deploy a data collection tool to the Kubernetes to collect the resources of the Kubernetes, and tag the collected resources with application information based on Label tags and / or Annonation annotations and associate them with the resources of the corresponding application and business system. The collected resources include basic resources, storage resources, network resources, access control resources, workload resources, and configuration resources.

[0008] The collected resources are displayed in the CMDB in the form of a visual ledger, and the Kubernetes is monitored based on preset monitoring indicators and alarm rules.

[0009] Furthermore, establishing the communication between the CMDB and the Kubernetes API includes:

[0010] Communicate with the API of the Kubernetes based on the gPRC protocol of the Kubernetes, and during the communication, establish a connection pool mechanism to reuse the connection between the CMDB and the API of the Kubernetes to reduce the overhead of frequent establishment and connection;

[0011] And during communication, through the automatic retry mechanism, it is automatically retried when the API call of the Kubernetes fails, and the retry time is extended when the number of call failures exceeds a threshold.

[0012] Furthermore, during communication, multiple requests are processed in a non-blocking manner to implement asynchronous API calls and integrate the API aggregation layer of Kubernetes.

[0013] Furthermore, when polling the API of the Kubernetes, polling is performed based on the gPRC protocol of the Kubernetes, or by monitoring the information returned by the API of the Kubernetes, polling is triggered when there is an actual change.

[0014] Further, when subscribing to the resource change event of the Kubernetes in real time through the event monitor, it includes:

[0015] Adjust monitoring accuracy based on current load and resource change frequency;

[0016] Fine-grained filtering of different resource types and keywords can be performed to improve monitoring efficiency.

[0017] Furthermore, the CMDB collects the resources of the Kubernetes through the Prometheus Operator tool.

[0018] Furthermore, when the collected resources are marked with application information, it includes:

[0019] Based on machine learning algorithms, analyze historical resource usage, predict and generate new business tags;

[0020] After the collected resources are marked and associated with the resources of the corresponding application and business system, including:

[0021] Update the relationship in real time when resources in the application or business system change.

[0022] Furthermore, the basic resources include: Cluster, Namespace, Node;

[0023] The storage resources include: StorageClass, Persistent Volume, PersistentVolumeClaim;

[0024] The network resources include: Ingress, NetworkPolicy, Endpoints, PortForwarding, Service, IngressClass;

[0025] The access control resources include: ServiceAccount, ClusterRole, ClusterRole Bonding, PodSecurity Policy, Role, and RoleBonding;

[0026] The workload resources include: Pod Workload, ReplicationController, and ReplicaSet;

[0027] The configuration resources include: ConfigMap, LimitRange, PriorityClass, Secret, HPA, RuntimeClass, ResourceQuota, PodDisruption Budget, and Lease.

[0028] According to another aspect of the present disclosure, a Kubernetes resource monitoring system based on CMDB is provided, including:

[0029] A resource tracking module is used to establish communication between the CMDB and the API of Kubernetes, so that the CMDB obtains, interprets and stores the resource information returned by Kubernetes in the form of JSON, polls the API of Kubernetes, compares the current polling result with the previous polling result, so that the newly added, deleted or updated resource information is reflected in the CMDB, or / and subscribes to the resource change events of Kubernetes in real time through an event monitor and establishes an asynchronous update mechanism that enables the CMDB to update the corresponding resource information;

[0030] The resource collection and association module is used to deploy the data collection tool to the Kubernetes to collect the resources of the Kubernetes, and to associate the collected resources with the resources of the corresponding application and business system after marking the application information based on the Label tag and / or Annonation annotation. The collected resources include basic resources, storage resources, network resources, access control resources, workload resources and configuration resources.

[0031] The visual monitoring module is used to display the collected resources in the form of a visual ledger in the CMDB, and monitor the Kubernetes based on preset monitoring indicators and alarm rules.

[0032] The technical solution disclosed in this disclosure has the following beneficial effects:

[0033] Based on the communication between CMDB and Kubernetes API, resources are dynamically discovered and tracked in real time during communication, which improves the sensitivity and real-time perception of dynamic changes in Kubernetes clusters, reduces the lag of resource management, solves resource management and monitoring problems, and brings positive impacts in real-time performance, communication efficiency and user experience. BRIEF DESCRIPTION OF THE DRAWINGS

[0034] Figure 1 This is a flow chart of a Kubernetes resource monitoring method based on CMDB in an embodiment of this specification;

[0035] Figure 2 This is a structural block diagram of a Kubernetes resource monitoring system based on CMDB in an embodiment of this specification;

[0036] Figure 3 A computer-readable storage medium storing a CMDB-based Kubernetes resource monitoring method in an embodiment of this specification. DETAILED DESCRIPTION

[0037] Example embodiments will now be described more fully with reference to the accompanying drawings. However, example embodiments can be implemented in a variety of forms and should not be construed as being limited to the examples set forth herein; on the contrary, these embodiments are provided so that the present disclosure will be more comprehensive and complete, and the concepts of the example embodiments are fully conveyed to those skilled in the art. The described features, structures, or characteristics may be combined in one or more embodiments in any suitable manner. In the following description, many specific details are provided to provide a full understanding of the embodiments of the present disclosure. However, those skilled in the art will appreciate that the technical solutions of the present disclosure may be practiced while omitting one or more of the specific details, or other methods, components, systems, steps, etc. may be adopted. In other cases, known technical solutions are not shown or described in detail to avoid obscuring various aspects of the present disclosure.

[0038] In addition, the accompanying drawings are only schematic illustrations of the present disclosure. The same reference numerals in the figures represent the same or similar parts, and thus their repeated description will be omitted. Some of the block diagrams shown in the accompanying drawings are functional entities, which do not necessarily correspond to physically or logically independent entities. These functional entities can be implemented in software form, or implemented in one or more hardware modules or integrated circuits, or implemented in different networks and / or processor systems and / or microcontroller systems.

[0039] like Figure 1 As shown, the embodiment of this specification provides a Kubernetes resource monitoring method based on CMDB, and the execution subject of the method can be a server. The method can specifically include the following steps S101 to S103:

[0040] In step S101, communication between the CMDB and the Kubernetes API is established so that the CMDB obtains, interprets, and stores the resource information returned by the Kubernetes in JSON format, polls the Kubernetes API, and compares the current polling result with the previous polling result so that the newly added, deleted, or updated resource information is reflected in the CMDB, or / and subscribes to the resource change events of the Kubernetes in real time through an event monitor and establishes an asynchronous update mechanism that enables the CMDB to update the corresponding resource information.

[0041] In step S102, a data collection tool is deployed to the Kubernetes to collect the resources of the Kubernetes, and based on Label tags and / or Annonation annotations, the collected resources are marked with application information and associated with the resources of the corresponding applications and business systems. The collected resources include basic resources, storage resources, network resources, access control resources, workload resources and configuration resources.

[0042] In step S103, the collected resources are displayed in the CMDB in the form of a visual ledger, and the Kubernetes is monitored based on preset monitoring indicators and alarm rules.

[0043] As a supplement to step S101, when establishing communication between the CMDB and the Kubernetes API, communication with the Kubernetes API is carried out based on the Kubernetes gPRC protocol, and during communication, a connection pool mechanism is established to reuse the connection between the CMDB and the Kubernetes API to reduce the overhead of frequent establishment and connection; and during communication, an automatic retry mechanism is used to automatically retry when a call to the Kubernetes API fails, and the retry time is extended when the number of call failures exceeds a threshold.

[0044] The resource information obtained by establishing communication can be nodes, Pods, services, storage volumes, etc. CMDB uses a data format parser to ensure that JSON or other formats of data obtained from the Kubernetes API are correctly parsed. The gRPC protocol is specifically a high-performance, open source remote procedure call framework. The connection pool mechanism is specifically a mechanism for managing and maintaining network connections. In communication, frequent establishment and closing of connections will bring certain overhead, so the connection pool is introduced to improve efficiency. The connection pool will pre-create a certain number of connections at startup and save them in the pool. When API communication is required, an available connection can be obtained from the connection pool. After use, it is returned to the pool instead of being closed immediately. This can reduce the number of connection establishment and closure times, improve resource utilization, and also better cope with the high concurrency requirements of Kubernetes. The automatic retry mechanism refers to the ability to automatically retry when a failure or error occurs during communication, which helps to improve the fault tolerance and stability of communication. The automatic retry mechanism can specifically include an exponential backoff strategy, that is, after each retry failure, the waiting time will increase exponentially to avoid excessive retry requests in the event of a transient network failure. It can handle transient network problems to a certain extent, ensure that recovery can be automatically attempted in the face of some short-term abnormal situations, and improve the reliability of communication.

[0045] In addition, when performing API communication, multiple requests are processed in a non-blocking manner to implement asynchronous API calls and integrate the API aggregation layer of Kubernetes. The non-blocking method means that by adopting the asynchronous API call method, you do not have to wait for a response after sending a request, but continue to perform other tasks, so that multiple requests can be processed effectively, the overall performance and response speed can be improved, the computing resources can be used to the maximum extent, and the concurrent processing capability can be improved. This is very beneficial for processing a large number of concurrent requests in the Kubernetes cluster, and can significantly improve the performance and throughput of the system.

[0046] In addition, a polling mechanism and a real-time tracking mechanism are proposed in step S101. When polling the Kubernetes API, polling is performed based on the gPRC protocol of the Kubernetes to obtain the current Kubernetes cluster status, and then by comparing the results of the two previous pollings, new, deleted or updated resources are found. This is a static, periodic process, which is a snapshot capture and analysis of the entire cluster status; while the real-time tracking mechanism pays more attention to real-time, and subscribes to event notifications of the Kubernetes API in real time through an event listener, which enables the CMDB to perceive resource changes in real time, rather than just discovering them when polling. This is a dynamic, event-driven mechanism that is more sensitive to immediate and irregular changes. At the same time, the two can also be combined, by real-time monitoring of the information returned by the Kubernetes API, and triggering polling when there is an actual change. And, in real-time tracking, an asynchronous update mechanism is established to ensure that when resources in the Kubernetes cluster change, the CMDB system can obtain and update the corresponding resource information in real time without waiting for synchronization to complete.

[0047] The asynchronous update mechanism is to establish an asynchronous task queue or message queue to store the change events received from the event listener. When the listener captures the event, the event information is placed in the queue without blocking the execution of the main thread. At the same time, an asynchronous task processor is designed to be responsible for taking out the event information from the queue and performing the corresponding update operation. The processor can use multi-threading or asynchronous IO mechanisms to ensure that the processing of one event will not affect the processing of other events. That is, in the asynchronous task processor, its implementation logic is to reflect the change information in the event to the database of the CMDB system.

[0048] When subscribing to the resource change events of the Kubernetes in real time through the event monitor, the monitoring accuracy is adjusted according to the current load and resource change frequency, and fine-grained filtering is performed on different resource types and keywords to improve the monitoring efficiency and realize adaptive event monitoring.

[0049] In one embodiment, the CMDB collects the resources of the Kubernetes through the Prometheus Operator tool. Among them, Prometheus Operator is an operation and maintenance tool that can be used for Kubernetes, and defines configurations such as Prometheus and ServiceMonitors in the form of custom resources. The CMDB can be directly integrated with Kubernetes through Prometheus Operator without additional deployment.

[0050] In one embodiment, when the collected resources are marked with application information, the historical usage of the resources is analyzed based on a machine learning algorithm to predict and generate new business tags; after the collected resources are marked and associated with the resources of the corresponding applications and business systems, the association relationship is updated in real time based on the change of resources in the application or business system. Specifically, the association history learning can be used to analyze the association pattern between resources and applications, including which applications use the resources, which resources are used by the applications, and other information. Then, the association rules and association models between resources are clearly defined in the CMDB system, such as the parent-child relationship, dependency relationship, topological relationship, etc. of the resources, and then, through the event listener, the event notification provided by the Kubernetes API is subscribed to, and a special association information storage area is established in the CMDB system for storing the association information between resources, and the data structure and database table are designed to adapt to the storage requirements of different types of association information, to ensure that the association relationship is updated immediately when the resource association changes, and to update this information in real time to the association information storage area, so that the association information can reflect the dynamic changes of the system in a more real-time manner.

[0051] In one embodiment, the basic resources include: Cluster, Namespace, Node; the storage resources include: StorageClass, Persistent Volume, Persistent VolumeClaim; the network resources include: Ingress, NetworkPolicy, Endpoints, PortForwarding, Service, IngressClass; the access control resources include: ServiceAccount, ClusterRole, ClusterRole Bonding, PodSecurity Policy (Pod security policy), Role (role), RoleBonding (role binding); the workload resources include: PodWorkload (Pod workload), ReplicationController (replication controller), ReplicaSet (replica set); the configuration resources include: ConfigMap (configuration map), LimitRange (limit range), PriorityClass (priority class), Secret (key), HPA (horizontal automatic expansion), RuntimeClass (runtime class), ResourceQuota (resource quota), PodDisruption Budget (Pod interruption budget), Lease (lease).

[0052] In one embodiment, the collected resources are displayed in the CMDB in the form of a visual ledger. The ledger module can be designed in the CMDB system to display the collected resource information in a visual form, such as tables, charts, topology diagrams, etc., so that users can intuitively understand the status and relationship of each resource in the Kubernetes cluster. When monitoring Kubernetes based on preset monitoring indicators and alarm rules, the indicators that need to be monitored, such as CPU utilization, memory usage, network traffic, etc., can be preset according to business needs and system performance, and the conditions and levels for triggering alarms can be set. For example, when the CPU utilization of a Pod exceeds the threshold, an alarm is triggered. These rules are based on the status of resources, performance indicators, events and other conditions. When monitoring, expand when collecting resources, regularly obtain monitoring indicator data in the Kubernetes cluster, or monitor in real time for indicators with high real-time requirements to ensure that the system can capture changes in a timely manner.

[0053] Based on the same idea, Figure 2 As shown, the exemplary embodiment of the present disclosure also provides a Kubernetes resource monitoring system based on CMDB, including: a resource tracking module 201, which is used to establish communication between the CMDB and the API of Kubernetes, so that the CMDB obtains, interprets, and stores the resource information returned by the Kubernetes in the form of JSON, polls the API of the Kubernetes, compares the current polling result with the previous polling result, so that the newly added, deleted, or updated resource information is reflected in the CMDB, or / and, subscribes to the resource change events of the Kubernetes in real time through the event monitor and establishes a mechanism for the CMDB to update the corresponding resource information Asynchronous update mechanism; resource collection and association module 202, used to deploy data collection tools to the Kubernetes to collect the resources of the Kubernetes, and based on Label tags and / or Annonation annotations, the collected resources are marked with application information and associated with the resources of the corresponding applications and business systems. The collected resources include basic resources, storage resources, network resources, access control resources, workload resources and configuration resources; visual monitoring module 203, used to display the collected resources in the form of a visual ledger in the CMDB, and monitor the Kubernetes based on preset monitoring indicators and alarm rules.

[0054] The present invention is based on the communication between CMDB and Kubernetes API, dynamically discovers resources and tracks them in real time during communication, improves the sensitivity and real-time perception of dynamic changes in Kubernetes clusters, reduces the lag of resource management, solves resource management and monitoring problems, and brings positive effects in terms of real-time performance, communication efficiency and user experience.

[0055] The specific details of each module in the above system have been described in detail in the implementation method of the method part. The undisclosed details can be found in the implementation method of the method part, so they will not be repeated here.

[0056] Based on the same idea, the exemplary embodiments of the present disclosure also provide a computer-readable storage medium on which a program product capable of implementing the above method of the present specification is stored. In some possible implementations, various aspects of the present disclosure may also be implemented in the form of a program product, which includes a program code, and when the program product is run on a terminal device, the program code is used to enable the terminal device to execute the steps according to various exemplary implementations of the present disclosure described in the above "Kubernetes resource monitoring method based on CMDB" section of the present specification.

[0057] refer to Figure 3As shown, a program product 300 for implementing the above method according to an exemplary embodiment of the present disclosure is described, which can adopt a portable compact disk read-only memory (CD-ROM) and include program code, and can be run on a terminal device, such as a personal computer. However, the program product of the present disclosure is not limited thereto. In this document, a readable storage medium can be any tangible medium containing or storing a program, which can be used by or in combination with an instruction execution system, system or device.

[0058] The program product may use any combination of one or more readable media. The readable medium may be a readable signal medium or a readable storage medium. The readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, system or device, or any combination of the above. More specific examples of readable storage media (a non-exhaustive list) include: an electrical connection with one or more wires, a portable disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above.

[0059] Computer readable signal media may include data signals propagated in baseband or as part of a carrier wave, wherein readable program code is carried. Such propagated data signals may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. Readable signal media may also be any readable medium other than a readable storage medium, which may send, propagate, or transmit a program for use by or in conjunction with an instruction execution system, system, or device.

[0060] The program code embodied on the readable medium may be transmitted using any appropriate medium, including but not limited to wireless, wired, optical cable, RF, etc., or any suitable combination of the foregoing.

[0061] Program code for performing the operations of the present disclosure may be written in any combination of one or more programming languages, including object-oriented programming languages ​​such as Java, C++, etc., and conventional procedural programming languages ​​such as "C" or similar programming languages. The program code may be executed entirely on the user computing device, partially on the user device, as a separate software package, partially on the user computing device and partially on a remote computing device, or entirely on a remote computing device or server. In cases involving a remote computing device, the remote computing device may be connected to the user computing device through any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computing device (e.g., through the Internet using an Internet service provider).

[0062] Through the description of the above implementation, it is easy for those skilled in the art to understand that the example implementation described here can be implemented by software, or by software combined with necessary hardware. Therefore, the technical solution according to the implementation of the present disclosure can be embodied in the form of a software product, which can be stored in a non-volatile storage medium (which can be a CD-ROM, a USB flash drive, a mobile hard disk, etc.) or on a network, including several instructions to enable a computing device (which can be a personal computer, a server, a terminal system, or a network device, etc.) to execute the method according to the exemplary implementation of the present disclosure.

[0063] In addition, the above-mentioned figures are only schematic illustrations of the processes included in the method according to the exemplary embodiment of the present disclosure, and are not intended to be limiting. It is easy to understand that the processes shown in the above-mentioned figures do not indicate or limit the time sequence of these processes. In addition, it is also easy to understand that these processes can be performed synchronously or asynchronously, for example, in multiple modules.

[0064] It should be noted that, although several modules or units of the device for action execution are mentioned in the above detailed description, this division is not mandatory. In fact, according to the exemplary embodiments of the present disclosure, the features and functions of two or more modules or units described above can be embodied in one module or unit. Conversely, the features and functions of one module or unit described above can be further divided into multiple modules or units to be embodied.

[0065] Those skilled in the art will readily appreciate other embodiments of the present disclosure after considering the specification and practicing the invention disclosed herein. This application is intended to cover any variations, uses, or adaptations of the present disclosure that follow the general principles of the present disclosure and include common knowledge or customary technical means in the art that are not disclosed in the present disclosure. The specification and embodiments are to be considered exemplary only, and the true scope and spirit of the present disclosure are indicated by the claims.

Claims

1. A Kubernetes resource monitoring method based on CMDB, It is characterized in that The method comprises: Establish communication between CMDB and Kubernetes API, so that the CMDB obtains, interprets and stores resource information returned by Kubernetes in JSON format, polls the Kubernetes API, compares the current polling result with the previous polling result, so that the newly added, deleted or updated resource information is reflected in the CMDB, and subscribes to the resource change events of Kubernetes in real time through the event monitor and establishes an asynchronous update mechanism that enables the CMDB to update the corresponding resource information. The establishment of communication between CMDB and Kubernetes API includes: communicating with the Kubernetes API based on the gPRC protocol of Kubernetes, and establishing a connection pool mechanism during communication to reuse The CMDB is connected to the API of the Kubernetes to reduce the overhead of frequent establishment and connection; and during communication, an automatic retry mechanism is used to automatically retry when the API call of the Kubernetes fails, and the retry time is extended when the number of call failures exceeds a threshold, and multiple requests are processed in a non-blocking manner to realize asynchronous API calls and integrate the API aggregation layer of the Kubernetes; the asynchronous update mechanism is to establish an asynchronous task queue or message queue for storing change events received from the event listener, and when the listener captures the event, the event information is placed in the queue so as not to block the execution of the main thread; the automatic retry mechanism includes an exponential backoff strategy, which means that after each retry failure, the waiting time will increase exponentially; Deploy a data collection tool to the Kubernetes to collect the resources of the Kubernetes, and based on the Label tag and / or the Annonation annotation, mark the collected resources with application information and associate them with the resources of the corresponding application and business system. The collected resources include basic resources, storage resources, network resources, access control resources, workload resources and configuration resources. The basic resources include: Cluster, Namespace, Node; the storage resources include: StorageClass, Persistent Volume, Persistent VolumeClaim; the network resources include: Ingress, NetworkPolicy, Endpoints, PortForwarding, Service, IngressClass; the access control resources include: ServiceAccount, ClusterRole, ClusterRole Bonding, PodSecurityPolicy, Role, RoleBonding; the workload resources include: Pod Workload, ReplicationController, ReplicaSet; the configuration resources include: ConfigMap, LimitRange, PriorityClass, Secret, HPA, RuntimeClass, ResourceQuota, PodDisruption Budget, Lease; The collected resources are displayed in the CMDB in the form of a visual ledger, and the Kubernetes is monitored based on preset monitoring indicators and alarm rules.

2. According to a CMDB-based Kubernetes resource monitoring method according to claim 1, It is characterized in that When polling the API of the Kubernetes, polling is performed based on the gRPC protocol of the Kubernetes, or by monitoring the information returned by the API of the Kubernetes, and polling is triggered when there is an actual change.

3. According to a CMDB-based Kubernetes resource monitoring method according to claim 1, It is characterized in that When subscribing to the resource change event of the Kubernetes in real time through the event monitor, it includes: Adjust monitoring accuracy based on current load and resource change frequency; Fine-grained filtering of different resource types and keywords can be performed to improve monitoring efficiency.

4. According to a CMDB-based Kubernetes resource monitoring method according to claim 1, It is characterized in that The CMDB collects the resources of the Kubernetes through the Prometheus Operator tool.

5. According to a CMDB-based Kubernetes resource monitoring method according to claim 1, It is characterized in that When the collected resources are marked with application information, it includes: Based on machine learning algorithms, analyze historical resource usage, predict and generate new business tags; After the collected resources are marked and associated with the resources of the corresponding application and business system, including: When resources in an application or business system change, the association relationship is updated in real time.

6. A Kubernetes resource monitoring system based on CMDB, It is characterized in that include: The resource tracking module is used to establish communication between the CMDB and the Kubernetes API, so that the CMDB obtains, interprets and stores the resource information returned by the Kubernetes in JSON format, polls the Kubernetes API, compares the current polling result with the previous polling result, so that the newly added, deleted or updated resource information is reflected in the CMDB, and subscribes to the resource change events of the Kubernetes in real time through the event monitor and establishes an asynchronous update mechanism for the CMDB to update the corresponding resource information; the establishment of communication between the CMDB and the Kubernetes API includes: communicating with the Kubernetes API based on the Kubernetes gPRC protocol, and establishing a connection pool during communication Mechanism, multiplexing the connection between the CMDB and the Kubernetes API to reduce the overhead of frequent establishment and connection; and during communication, through the automatic retry mechanism, automatically retry when the Kubernetes API call fails, and extend the retry time when the number of call failures exceeds the threshold, and process multiple requests in a non-blocking manner to realize asynchronous API calls and integrate the Kubernetes API aggregation layer; the asynchronous update mechanism is to establish an asynchronous task queue or message queue for storing change events received from the event listener, and when the listener captures the event, put the event information into the queue so as not to block the execution of the main thread; the automatic retry mechanism includes an exponential backoff strategy, which means that after each retry failure, the waiting time will increase exponentially; The resource collection and association module is used to deploy the data collection tool to the Kubernetes to collect the resources of the Kubernetes, and based on the Label tag and / or the Annonation annotation, the collected resources are marked with application information and associated with the resources of the corresponding application and business system. The collected resources include basic resources, storage resources, network resources, access control resources, workload resources and configuration resources; the basic resources include: Cluster, Namespace, Node; the storage resources include: StorageClass, Persistent Volume, Persistent VolumeClaim; the network resources include: Ingress, NetworkPolicy, Endpoints, PortForwarding, Service, IngressClass; the access control resources include: ServiceAccount, ClusterRole, ClusterRole Bonding, PodSecurity Policy, Role, RoleBonding; the workload resources include: Pod Workload, ReplicationController, ReplicaSet; the configuration resources include: ConfigMap, LimitRange, PriorityClass, Secret, HPA, RuntimeClass, ResourceQuota, PodDisruption Budget, Lease; The visual monitoring module is used to display the collected resources in the form of a visual ledger in the CMDB, and monitor the Kubernetes based on preset monitoring indicators and alarm rules.

Citation Information

Patent Citations

  • Resource management method and device for nodes in Kubernetes and medium

    CN111367659A

  • Distributed asynchronous data communication processing method and device, medium and equipment

    CN114116262A

  • Automatic management system for managing elasticsearch cluster in enterprise

    CN117235035A

Cited By

  • Kubernetes-driven control of network hardware systems

    US12494965B1

  • Kubernetes-driven control of network hardware systems

    US20250379785A1