A method and system for monitoring Kubernetes operation
By deploying Agent services in Kubernetes clusters, monitoring the command line execution results of Pods and feeding them back to Service services, the meticulousness and early warning problems of Pod monitoring in the cluster are solved, and operation and maintenance efficiency is improved.
Patent Information
- Application Number
- CN202111405348.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-11-24
- Publication Date
- 2025-08-19
- Estimated Expiration
- 2041-11-24
AI Technical Summary
The existing technology is difficult to meticulously monitor Pods in Kubernetes clusters, and lacks an effective early warning mechanism, which affects operation and maintenance efficiency.
Deploy the Agent service in the Kubernetes cluster, execute the command line and feed the results back to the unified Service service for analysis and early warning, and monitor the Pod operation process.
It realizes meticulous monitoring and rapid and accurate early warning of the Pod operation process, improves the management efficiency of operation and maintenance personnel, and does not change the network structure of the original Kubernetes cluster.
Smart Images

Figure CN114090386B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of cloud computing, and in particular to a method and system for monitoring Kubernetes operations. Background Art
[0002] Cloud computing technology is maturing, and an increasing number of applications and services are being deployed in the cloud. The best solution for managing and orchestrating cloud applications and programs is to use Kubernetes for control. Kubernetes provides a mechanism for application deployment, planning, updating, and maintenance. Kubernetes is typically deployed in a cluster, typically by clustering several servers to deploy Kubernetes components. Kubernetes provides users with many core features, including self-healing, elastic scaling, service discovery and load balancing, rolling upgrades, and one-click rollbacks. In the daily use of cloud computing, a large number of containers need to be run, requiring more detailed monitoring of the operation of each container and a more effective early warning mechanism. Summary of the Invention
[0003] The technical task of the present invention is to address the above shortcomings and provide a method and system for monitoring Kubernetes operation. By deploying a monitoring application Service service on the corresponding management side of the Kubernetes cluster, the Pod command line execution results in the Kubernetes cluster are analyzed to troubleshoot problems that may be encountered during the Pod operation.
[0004] The technical solution adopted by the present invention to solve its technical problem is:
[0005] A method for monitoring Kubernetes operations by monitoring the command line execution results of Pods in the Kubernetes cluster. An Agent service is deployed in the Pods in the Kubernetes cluster to execute command lines and feed the execution results back to a unified Service to troubleshoot problems that may occur during Pod operation.
[0006] The implementation of this method consists of two parts:
[0007] In the Kubernetes cluster, the Pod runs the Agent service to execute the command line. The Agent service executes the command line that the Pod needs to execute set in the Service service and feeds back the execution result to the Service service.
[0008] The Service collects the Agent service command line execution results and performs analysis, display, and warnings.
[0009] Furthermore, a Pod monitoring application Service is deployed on a node on the management side of the cluster, and an Agent service is deployed in the Pod, so that the Service and Agent services are deployed in the same cluster. Related configuration parameters are modified so that the Service and Agent services can access each other.
[0010] The Agent service executes the command line that the Pod needs to execute set in the Service service, and feeds back the execution results of the command line to the Service service at every time node. After collecting the execution results of the Agent service command line in the pod, the Service service analyzes and displays them, and performs warning operations for specific execution results.
[0011] Preferably, the Service includes:
[0012] Configure the Agent service: To configure the Agent service in the Service service, you need to add the relevant parameters of the Agent service; after the addition is completed, send a command line execution request to the corresponding Agent service;
[0013] Data receiving service: The Service service starts a specific HTTP service to receive data sent by the Agent service. After the Agent service is configured, the Agent service will regularly feed back the command line execution results to the Service service. The Service will store the received data in the local database according to the specified structure.
[0014] Data analysis service: The Service service regularly analyzes previously stored services, displays them through HTML pages, and categorizes them according to Agent services;
[0015] Early warning service: Configure the Service data analysis service. When the command line execution result is equal to or not equal to the pre-set result, an early warning prompt will be sent.
[0016] Preferably, the parameters related to the newly added Agent service include: Agent service IP, command line execution time interval, command line execution times, command line name, command line, and command line execution result;
[0017] The Service service in the data analysis service periodically analyzes previously stored services. The analysis data includes the Agent service IP, time, command line name, command line, and command line execution results.
[0018] Preferably, the early warning prompt service specifies Agent service A to execute the command line top in the Service service. When the %CUP data in the execution result is greater than 100, a resource early warning prompt is issued, and the early warning prompt includes an email warning and / or a page display warning.
[0019] Preferably, the Agent service function includes: executing the command line configured in the Service service at a specified time interval; and sending the result of executing the command line to the Service service at a regular interval.
[0020] Furthermore, the Agent service includes:
[0021] Execute command lines: After receiving the command line execution request sent by the Service service, the Agent service periodically executes the relevant command lines according to the parameters in the request and stores the results in the local database.
[0022] Send command line execution results to the Service: The Agent service sends command line execution results to the Service service via HTTP requests at specific intervals. The request data includes: the Agent service IP address, command line execution interval, command line execution count, command line name, command line, and command line execution result.
[0023] This method does not require changing the original deployment method of the Kubernetes cluster. It only requires deploying the Pod monitoring application Service service on a node in the cluster, deploying the Agent service in the Pod, and modifying the relevant configuration parameters so that the Service service and the Agent service can access each other. Among them, the main function of the Agent service is to execute the command line set in the Service service that the Pod needs to execute, and feed back the execution results of the command line to the Service service at intervals. After collecting the execution results of the Agent service command line in the pod, the Service service analyzes and displays them, and performs early warning operations on specific execution results, thereby achieving the monitoring and early warning function.
[0024] The present invention also claims protection for a system for monitoring Kubernetes operation, which monitors Kubernetes operation by monitoring the execution results of Pod command lines in the Kubernetes cluster.
[0025] This system implements the above-mentioned method for monitoring Kubernetes operation.
[0026] The present invention also claims protection for a device for monitoring Kubernetes operation, comprising: at least one memory and at least one processor;
[0027] The at least one memory is configured to store a machine-readable program;
[0028] The at least one processor is configured to call the machine-readable program to execute the above-mentioned method for monitoring Kubernetes operation.
[0029] The present invention also claims protection for a computer-readable medium having computer instructions stored thereon, which, when executed by a processor, cause the processor to perform the above-described method for monitoring Kubernetes operation.
[0030] Compared with the prior art, the method and system for monitoring Kubernetes operation of the present invention have the following beneficial effects:
[0031] This method can be used to monitor Kubernetes operations without changing the original Kubernetes cluster's network structure. Instead, it can be expanded and made compatible with the original network model.
[0032] This method can observe the execution results of the command lines in the specified pod in more detail and analyze and display the execution results.
[0033] This method provides a monitoring and early warning mechanism, providing faster and more accurate feedback on command line execution, helping operations personnel better utilize Kubernetes cluster services. BRIEF DESCRIPTION OF THE DRAWINGS
[0034] Figure 1 This is an architectural diagram of a method for monitoring Kubernetes operations provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0035] The present invention will be further described below with reference to the accompanying drawings and specific embodiments.
[0036] A method for monitoring Kubernetes operation, which monitors Kubernetes operation by monitoring the execution results of Pod command lines in the Kubernetes cluster. An Agent service is deployed in the Pod in the Kubernetes cluster to execute command lines and feedback the execution results to a unified Service service to troubleshoot problems that may be encountered during the Pod operation.
[0037] This method eliminates the need to change the existing Kubernetes cluster deployment method. Instead, you simply deploy a Pod monitoring application, the Service, on a node in the cluster, deploy an Agent within the Pod, and modify relevant configuration parameters to allow the Service and Agent to access each other. The Agent's primary function is to execute the command lines specified in the Service for the Pod and report the command execution results back to the Service at regular intervals. The Service collects the results of the Agent's command execution within the pod, analyzes and displays them, and issues alerts for specific execution results, thus achieving monitoring and early warning capabilities.
[0038] The implementation of this method consists of two parts:
[0039] One part is to run the Agent service in the Pod in the Kubernetes cluster to execute the command line;
[0040] The other part is that the Service service collects the execution results of the Agent service command line and performs analysis, display and warning.
[0041] It is necessary to deploy the Pod monitoring application Service service on a node in the cluster's management system, deploy the Agent service in the Pod, and modify the relevant configuration parameters so that the Service service and the Agent service can access each other.
[0042] Service:
[0043] Deploy the Pod monitoring application Service on a node in the cluster's management layer. The Service's primary function is to receive data sent periodically by the Agent service and perform data analysis, early warning, and display. The Service and Agent services must be deployed in the same cluster, and the Service and Agent services must be able to access each other.
[0044] The following example illustrates a specific Service service:
[0045] 1) Configure the Agent service: To configure the Agent service in the Service, you need to add relevant parameters for the Agent service, such as the Agent service IP address, command line execution interval, command line execution count, command line name, command line, and command line execution result. After adding the parameters, send a command line execution request to the corresponding Agent service.
[0046] 2) Data receiving service: The Service service starts a specific Http service to receive data sent by the Agent service. After the Agent service is configured, the Agent service will regularly feed back the command line execution results to the Service service. The Service will store the received data in the local database according to the specified structure.
[0047] 3) Data analysis service: The Service service will regularly analyze previously stored services. The analysis data includes the Agent service IP, time, command line name, command line, and command line execution results. It is displayed through an Html page and classified according to the Agent service.
[0048] 4) Early Warning Service: Configure the Service data analysis service to send an early warning when the command execution result is equal to or different from the pre-set result. For example, if you specify Agent A in the Service to execute the command line top, and the %CUP value in the execution result is greater than 100, a resource warning will be issued. Warnings include email alerts, web page display alerts, and more.
[0049] Agent service:
[0050] The Agent service needs to run in every Pod resource that needs to be monitored. It has two main functions: one is to execute the command line configured in the Service service at a specified time interval, and the other is to send the results of the command line execution to the Service service at a specified time interval.
[0051] The following example illustrates the specific Agent service:
[0052] 1) Execute command line: After receiving the command line execution request sent by the Service service, the Agent service executes the relevant command line at a fixed time according to the parameters in the request and stores the results in the local database.
[0053] 2) Send command line execution results to the Service: The Agent service sends command line execution results to the Service service via HTTP requests at specific intervals. The request data includes: Agent service IP address, command line execution interval, command line execution count, command line name, command line, and command line execution result.
[0054] The embodiment of the present invention also provides a system for monitoring the operation of Kubernetes, which monitors the operation of Kubernetes by monitoring the execution results of Pod command lines in the Kubernetes cluster.
[0055] The system implements the method for monitoring Kubernetes operation described in the above embodiment of the present invention.
[0056] An embodiment of the present invention further provides a device for monitoring Kubernetes operation, comprising: at least one memory and at least one processor;
[0057] The at least one memory is configured to store a machine-readable program;
[0058] The at least one processor is configured to call the machine-readable program to execute the method for monitoring Kubernetes operation described in the above embodiment of the present invention.
[0059] An embodiment of the present invention further provides a computer-readable medium having computer instructions stored thereon. When executed by a processor, the computer instructions cause the processor to perform the method for monitoring Kubernetes operations described in the above-described embodiment of the present invention. Specifically, a system or device equipped with a storage medium can be provided. The storage medium stores software program code that implements the functions of any of the above-described embodiments, and causes a computer (or CPU or MPU) of the system or device to read and execute the program code stored in the storage medium.
[0060] In this case, the program code itself read from the storage medium can realize the function of any one of the above-mentioned embodiments, and thus the program code and the storage medium storing the program code constitute part of the present invention.
[0061] Examples of storage media for providing program code include floppy disks, hard disks, magneto-optical disks, optical disks (such as CD-ROM, CD-R, CD-RW, DVD-ROM, DVD-RAM, DVD-RW, DVD+RW), magnetic tapes, non-volatile memory cards, and ROMs. Alternatively, the program code can be downloaded from a server computer via a communication network.
[0062] In addition, it should be clear that the functions of any of the above embodiments can be achieved not only by executing the program code read by the computer, but also by enabling the operating system operating on the computer to complete part or all of the actual operations based on the instructions of the program code.
[0063] In addition, it can be understood that the program code read from the storage medium is written into the memory provided in the expansion board inserted into the computer or into the memory provided in the expansion unit connected to the computer, and then based on the instructions of the program code, the CPU installed on the expansion board or expansion unit is enabled to perform part or all of the actual operations, thereby realizing the functions of any of the above embodiments.
[0064] The present invention has been shown and described in detail above through the accompanying drawings and preferred embodiments. However, the present invention is not limited to these disclosed embodiments. Based on the above multiple embodiments, those skilled in the art can know that the code review methods in the above different embodiments can be combined to obtain more embodiments of the present invention, and these embodiments are also within the scope of protection of the present invention.
Claims
1. A method for monitoring Kubernetes operation, characterized in that: Monitor Kubernetes operation by monitoring the command line execution results of Pods in the Kubernetes cluster. Deploy Agent services in Pods in the Kubernetes cluster to execute command lines and feed back the execution results to a unified Service service to troubleshoot problems that may occur during Pod operation. The implementation of this method consists of two parts: In the Kubernetes cluster, the Pod runs the Agent service to execute the command line. The Agent service executes the command line that the Pod needs to execute set in the Service service and feeds back the execution result to the Service service. The Service collects the results of the Agent service command line execution and performs analysis, display, and warning. Deploy the Pod monitoring application Service on a node on the management side of the cluster, deploy the Agent service in the Pod, deploy the Service and Agent services in the same cluster, and modify the relevant configuration parameters so that the Service and Agent services can access each other. The Agent service executes the command line that the Pod needs to execute set in the Service service, and feeds back the execution results of the command line to the Service service at every time node. After collecting the execution results of the Agent service command line in the pod, the Service service analyzes and displays them, and performs warning operations for specific execution results.
2. A method for monitoring Kubernetes operation according to claim 1, characterized in that The Service includes: Configure the Agent service: To configure the Agent service in the Service service, you need to add the relevant parameters of the Agent service; after the addition is completed, send a command line execution request to the corresponding Agent service; Data receiving service: The Service service starts a specific HTTP service to receive data sent by the Agent service. After the Agent service is configured, the Agent service will regularly feed back the command line execution results to the Service service. The Service will store the received data in the local database according to the specified structure. Data analysis service: The Service service regularly analyzes previously stored services, displays them through HTML pages, and categorizes them according to Agent services; Early warning service: Configure the Service data analysis service. When the command line execution result is equal to or not equal to the pre-set result, an early warning prompt will be sent.
3. A method for monitoring Kubernetes operation according to claim 2, characterized in that: The parameters related to the newly added Agent service include: Agent service IP, command line execution time interval, command line execution times, command line name, command line, and command line execution result; The Service service in the data analysis service periodically analyzes previously stored services. The analysis data includes the Agent service IP, time, command line name, command line, and command line execution results.
4. A method for monitoring Kubernetes operation according to claim 2, characterized in that: The early warning prompt service specifies Agent service A in the Service service to execute the command line top. When the %CUP data in the execution result is greater than 100, a resource early warning prompt is issued. The early warning prompt includes email warning and / or page display warning.
5. A method for monitoring Kubernetes operation according to claim 1, characterized in that: The Agent service function includes: executing the command line configured in the Service service at a specified time interval; and sending the result of executing the command line to the Service service at a regular interval.
6. A method for monitoring Kubernetes operation according to claim 5, characterized in that: The Agent service includes: Execute command lines: After receiving the command line execution request sent by the Service, the Agent service periodically executes the relevant command lines according to the parameters in the request and stores the results in the local database. Send command line execution results to the Service: The Agent service uniformly feeds back the command line execution results to the Service through HTTP requests at specific time intervals.
7. A system for monitoring Kubernetes operation, characterized in that: The system monitors Kubernetes operation by monitoring the execution results of Pod command lines in the Kubernetes cluster. The system implements the method for monitoring Kubernetes operation described in claims 1-6.
8. A device for monitoring Kubernetes operation, characterized in that: include: at least one memory and at least one processor; The at least one memory is configured to store a machine-readable program; The at least one processor is configured to call the machine-readable program to execute the method for monitoring Kubernetes operation according to any one of claims 1 to 6.
9. A computer-readable medium, characterized in that The computer-readable medium stores computer instructions, which, when executed by a processor, cause the processor to execute the method for monitoring Kubernetes operation according to any one of claims 1 to 6.
Citation Information
Patent Citations
Resource monitoring method based on Kubernetes
CN111752807A