A business system monitoring method and device based on Kubernetes

By obtaining runtime data of the Kubernetes system and business systems, matching monitoring rules and allocating resources, the problem of unified monitoring of the Kubernetes system and business systems is solved, and system stability and resource optimization are achieved.

CN112052133BActive Publication Date: 2024-09-20BEIJING JINGDONG SHANGKE INFORMATION TECH CO LTD +1
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN201910492965.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2019-06-06
Publication Date
2024-09-20
Estimated Expiration
2039-06-06

AI Technical Summary

Technical Problem

Existing technology cannot achieve unified monitoring of Kubernetes systems and business systems, making it difficult to effectively manage resource usage and task execution.

Method used

By obtaining the runtime data of the Kubernetes system and business systems, matching preset monitoring rules to trigger monitoring alerts, and calling the tag management interface to allocate idle resources to business systems, dynamically adjust the task execution sequence to optimize resource usage.

Benefits of technology

It achieves unified monitoring of the Kubernetes system and business systems, ensures stable operation of the system, improves task resource scheduling efficiency, and reduces the number of tasks to be executed.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN112052133B
    Figure CN112052133B
Patent Text Reader

Abstract

The present invention discloses a business system monitoring method and device based on Kubernetes, and relates to the field of computer technology. A specific implementation of the method includes: collecting log data generated after the Kubernetes system executes the task script submitted by the business system, and the operation data of the Kubernetes system; wherein the business system is deployed in the Kubernetes system; determining the task data when the business system is running according to the log data, matching the task data with a preset first monitoring rule, and matching the operation data with a preset second monitoring rule; when the task data meets the alarm triggering condition of the first monitoring rule, and / or the operation data meets the alarm triggering condition of the second monitoring rule, triggering a monitoring warning. The method obtains the task data when the business system deployed in the Kubernetes system is running, and the operation data of the Kubernetes system, matches the above data with the preset monitoring rules to trigger the monitoring warning, and realizes the unified monitoring of the Kubernetes system and the business system.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of computers, and in particular to a Kubernetes-based business system monitoring method and device. Background Art

[0002] The Kubernetes system is based on Google's internal Borg system and provides an application-oriented container cluster deployment and management system. Building a business system based on the Kubernetes system can provide efficient and stable technical services for the business system. How to uniformly monitor the resource usage of the Kubernetes system and the task execution of the business system is the basic guarantee for the stable operation of the system.

[0003] In the process of implementing the present invention, the inventors found that there are at least the following problems in the prior art:

[0004] It is impossible to achieve unified monitoring of Kubernetes systems and business systems in the existing technology. Summary of the invention

[0005] In view of this, an embodiment of the present invention provides a business system monitoring method and device based on Kubernetes, which obtains the task data of the business system deployed in the Kubernetes system at runtime and the operation data of the Kubernetes system, matches the above data with preset monitoring rules to trigger monitoring warnings, thereby realizing unified monitoring of the Kubernetes system and the business system.

[0006] To achieve the above objective, according to one aspect of an embodiment of the present invention, a business system monitoring method based on Kubernetes is provided.

[0007] A Kubernetes-based business system monitoring method according to an embodiment of the present invention comprises: collecting log data generated after the Kubernetes system executes a task script submitted by the business system, and operation data of the Kubernetes system; wherein the business system is deployed in the Kubernetes system; determining the task data when the business system is running according to the log data, matching the task data with a preset first monitoring rule, and matching the operation data with a preset second monitoring rule; triggering a monitoring warning when the task data meets the alarm triggering condition of the first monitoring rule, and / or the operation data meets the alarm triggering condition of the second monitoring rule.

[0008] Optionally, the method also includes: calling the label management interface of the Kubernetes system to label the idle resources of the Kubernetes system with the label of the business system; using part or all of the idle resources as new resources and allocating them to the tasks to be executed of the business system through the Kubernetes system.

[0009] Optionally, the business system is deployed to the Kubernetes system, and the Kubernetes system executes the task script submitted by the business system to generate log data, including: the business system publishes the image of the application to the image library, submits the task script to the script library, and sends the task request to the Kubernetes system; after the Kubernetes system determines that the image of the application does not exist locally, it pulls the image from the image library, and then downloads the task script from the script library; the Kubernetes system executes the task script to generate log data.

[0010] Optionally, the method also includes: determining the size of the target resources applied by the business system for the tasks to be executed and the newly added resources; if the newly added resources are smaller than the target resources and the newly added resources satisfy the high-priority tasks to be executed, then allocating the newly added resources to the high-priority tasks to be executed; if the newly added resources are smaller than the target resources and the newly added resources do not satisfy the high-priority tasks to be executed, then according to the execution evaluation results of the running tasks, terminating the designated tasks to be executed, and allocating the newly added resources to the unterminated tasks to be executed.

[0011] Optionally, the method also includes: if the priorities of multiple tasks to be executed are the same, dynamically adjusting the execution order of the tasks to be executed based on the historical running time and resource usage data of the tasks to be executed, so as to give priority to executing tasks to be executed with short historical running time or low resource usage.

[0012] To achieve the above objective, according to another aspect of an embodiment of the present invention, a Kubernetes-based business system monitoring device is provided.

[0013] A Kubernetes-based business system monitoring device according to an embodiment of the present invention comprises: a collection module, which is used to collect log data generated after the Kubernetes system executes a task script submitted by the business system, and the operation data of the Kubernetes system; wherein the business system is deployed in the Kubernetes system; a matching module, which is used to determine the task data of the business system when it is running according to the log data, match the task data with a preset first monitoring rule, and match the operation data with a preset second monitoring rule; and a triggering module, which is used to trigger a monitoring warning when the task data meets the alarm triggering condition of the first monitoring rule and / or the operation data meets the alarm triggering condition of the second monitoring rule.

[0014] Optionally, the device also includes: a resource adjustment module, which is used to call the label management interface of the Kubernetes system to label the idle resources of the Kubernetes system with the label of the business system; and to allocate part or all of the idle resources as new resources to the tasks to be executed of the business system through the Kubernetes system.

[0015] Optionally, the device also includes: a deployment and operation module, which is used for the business system to publish the image of the application to the image library, submit the task script to the script library, and send the task request to the Kubernetes system; after the Kubernetes system determines that the image of the application does not exist locally, it pulls the image from the image library, and then downloads the task script from the script library; and the Kubernetes system executes the task script to generate log data.

[0016] Optionally, the device also includes: a resource allocation module, used to determine the size of the target resources applied by the business system for the tasks to be executed and the newly added resources; if the newly added resources are smaller than the target resources and the newly added resources meet the requirements of the tasks to be executed with a high priority, the newly added resources are allocated to the tasks to be executed with a high priority; and if the newly added resources are smaller than the target resources and the newly added resources do not meet the requirements of the tasks to be executed with a high priority, then according to the execution evaluation results of the running tasks, the specified tasks to be executed are terminated, and the newly added resources are allocated to the tasks to be executed that have not been terminated.

[0017] Optionally, the device also includes: a task scheduling module, which is used to dynamically adjust the execution order of the tasks to be executed if the priorities of multiple tasks to be executed are the same, based on the historical running time and resource usage data of the tasks to be executed, so as to give priority to executing tasks to be executed with short historical running time or low resource usage.

[0018] To achieve the above objective, according to another aspect of an embodiment of the present invention, an electronic device is provided.

[0019] An electronic device according to an embodiment of the present invention includes: one or more processors; a storage system for storing one or more programs, and when the one or more programs are executed by the one or more processors, the one or more processors implement a business system monitoring method based on Kubernetes according to an embodiment of the present invention.

[0020] To achieve the above objective, according to another aspect of the embodiments of the present invention, a computer readable medium is provided.

[0021] A computer-readable medium according to an embodiment of the present invention stores a computer program, and when the program is executed by a processor, a business system monitoring method based on Kubernetes according to an embodiment of the present invention is implemented.

[0022] An embodiment of the above invention has the following advantages or beneficial effects: by obtaining the task data of the business system deployed in the Kubernetes system at runtime and the operation data of the Kubernetes system, the above data is matched with the preset monitoring rules to trigger monitoring warnings, thereby realizing unified monitoring of the Kubernetes system and the business system; when the task execution or the resource usage of the Kubernetes system is abnormal, the monitoring self-healing function is triggered to adjust resource allocation to ensure system stability; according to the target resources applied by the business system, the allocation of new resources is adjusted to reduce the impact on the execution of high-priority tasks, realize the linkage between the Kubernetes system and the business system, and improve the efficiency of task resources and Kubernetes unified scheduling; dynamically adjust the execution order of tasks to be executed, give priority to the execution of tasks to be executed with a shorter historical running time or lower resource usage, and ensure that the number of tasks to be executed in the queue is reduced.

[0023] The further effects of the above-mentioned non-conventional optional manner will be described below in conjunction with specific implementation examples. BRIEF DESCRIPTION OF THE DRAWINGS

[0024] The accompanying drawings are used to better understand the present invention and do not constitute an improper limitation of the present invention.

[0025] Figure 1 It is a schematic diagram of the main steps of the business system monitoring method based on Kubernetes according to an embodiment of the present invention;

[0026] Figure 2 is a system architecture diagram of a Kubernetes-based business system monitoring method according to an embodiment of the present invention;

[0027] Figure 3 is a schematic diagram of the operating principle of a Kubernetes-based business system according to an embodiment of the present invention;

[0028] Figure 4 This is a schematic diagram of the main process of the business system monitoring method based on Kubernetes according to an embodiment of the present invention;

[0029] Figure 5 is a schematic diagram of a graphical display result of a business system monitoring method based on Kubernetes according to an embodiment of the present invention;

[0030] Figure 6 is a schematic diagram of main modules of a business system monitoring device based on Kubernetes according to an embodiment of the present invention;

[0031] Figure 7 is an exemplary system architecture diagram to which embodiments of the present invention may be applied;

[0032] Figure 8 It is a schematic diagram of the structure of a computer device suitable for implementing the electronic device of the embodiment of the present invention. DETAILED DESCRIPTION

[0033] The following is a description of exemplary embodiments of the present invention in conjunction with the accompanying drawings, including various details of the embodiments of the present invention to facilitate understanding, which should be considered as merely exemplary. Therefore, it should be recognized by those of ordinary skill in the art that various changes and modifications may be made to the embodiments described herein without departing from the scope and spirit of the present invention. Similarly, for clarity and conciseness, the description of well-known functions and structures is omitted in the following description.

[0034] The technical terms involved in the embodiments of the present invention are explained below.

[0035] Kafka: A high-throughput distributed publish-subscribe messaging system that can handle all the action stream data in consumer-scale websites.

[0036] SDK: Software Development Kit, the full English name is Software Development Kit, which is generally a collection of development tools used by software engineers to build application software for specific software packages, software frameworks, hardware platforms, operating systems, etc.

[0037] Storm: is a distributed, fault-tolerant real-time computing system.

[0038] Kubelet: runs on each node as an agent, accepts Pods tasks assigned to the node, manages the life cycle of containers, monitors the resource usage of nodes, periodically obtains the running data of containers and Pods on the node, and feeds the running data back to kube-apiserver. kube-apiserver is the control entrance of the entire Kubernetes system.

[0039] Pod: It is the basic operation unit of Kubernetes and the carrier of application operation. A Pod can be composed of one or more containers, and the same Pod can only run on the same host.

[0040] etcd: used to store real-time operation data of the Kubernetes cluster, such as node status data.

[0041] Figure 1 Schematic diagram of the main steps of the Kubernetes-based business system monitoring method according to an embodiment of the present invention. Figure 1 As shown, the business system monitoring method based on Kubernetes in an embodiment of the present invention mainly includes the following steps:

[0042] Step S101: Collect log data generated after the Kubernetes system executes the task script submitted by the business system, and the operation data of the Kubernetes system; wherein the business system is deployed in the Kubernetes system. The business system is deployed to the Kubernetes system, and the Kubernetes system executes the task script submitted by the business system to generate log data. The monitoring device collects the above log data and the operation data of the Kubernetes system.

[0043] Step S102: Determine the task data when the business system is running according to the log data, match the task data with the preset first monitoring rule, and match the operation data with the preset second monitoring rule. The monitoring device obtains the dimensions according to the predetermined task data, and determines the task data of the corresponding dimensions according to the log data. For example, if the dimensions of the task data to be obtained are the task execution time, the task queue time, and the number of waiting tasks, the task data of the above dimensions can be determined based on the log data. In addition, the monitoring device supports user-defined monitoring rules, matches the task data and operation data with the corresponding monitoring rules, to determine whether the task data and operation data meet the corresponding monitoring rules.

[0044] Step S103: When the task data meets the alarm triggering condition of the first monitoring rule, and / or the operation data meets the alarm triggering condition of the second monitoring rule, a monitoring warning is triggered. If the monitoring device determines that either the task data or the operation data, or both of them meet the corresponding monitoring rules, a monitoring warning is triggered. At this point, unified monitoring of the Kubernetes system and the business system is achieved.

[0045] Figure 2 1 is a system architecture diagram of a Kubernetes-based business system monitoring method according to an embodiment of the present invention. Figure 2 As shown, the system includes a monitoring device, a business system, a Kubernetes system and an image repository. When the business system needs to be deployed to the Kubernetes system, a container can be allocated to each task according to the task name, related attributes, task running rules, etc. of the business system. In an embodiment, a container can be allocated to multiple tasks, or a container can be allocated to a task. The method of allocating a container to a task enables the task to run in an isolated environment. At the same time, resources can also be dynamically allocated based on the task itself. For example, after a holiday promotion, the amount of data will increase exponentially. At this time, for the task of extracting offline data, more resources can be provided for its corresponding container.

[0046] The monitoring device includes a business system monitoring module, a Kubernetes system monitoring module, a monitoring warning module, a monitoring self-healing module, and a monitoring view module. Among them, the business system monitoring module is used to collect log data of the business system. The Kubernetes system monitoring module is used to collect operation data of the Kubernetes system. The monitoring warning module is used to obtain task data based on log data, match task data with a preset first monitoring rule, and match operation data with a preset second monitoring rule; when the task data meets the alarm triggering condition of the first monitoring rule, and / or the operation data meets the alarm triggering condition of the second monitoring rule, the monitoring warning is triggered. The monitoring self-healing module is used to automatically trigger the system self-healing function after the monitoring warning is triggered. The monitoring view module is used to graphically display task data and operation data.

[0047] In addition, see the relationship between the business system, Kubernetes system and image repository. Figure 3 Description.

[0048] Figure 3 Schematic diagram of the operation principle of a Kubernetes-based business system according to an embodiment of the present invention. Figure 3 As shown in the figure, the operating principle of the Kubernetes-based business system is as follows:

[0049] Users report messages to Kafka through KafkaSDK, Kafka consumes messages through Storm, and presents the consumption results in the log area of ​​the web page. The execution process of the business system is:

[0050] (1) The Web client publishes the image of the application to the image library. The application refers to the computer program code corresponding to each task of the business system. In the embodiment, the Web management layer publishes the image of the application to the image library, and the image of the application is made by Dockerfile.

[0051] (2) The Web client submits the task script to the script library. In the embodiment, the Web management layer submits the task script to the script library.

[0052] (3) The Web client submits a task request to Kubelet. When the Web client submits a task request, it needs to specify the number of CPU cores and memory size required to execute the task. In the embodiment, a central node composed of at least one computer submits a task request to Kubelet, and tasks of the business system are deployed on the central node, which is managed by the Web management layer.

[0053] (4) The Kubernetes Node determines whether the application image exists locally. If not, it pulls the image from the image library. After pulling the image, the Docker of the Kubernetes Node starts running.

[0054] (5) The Docker instance of the Kubernetes Node downloads the latest task script from the script library and verifies the validity of the task script. The executor of the Docker instance checks the version of the task script, downloads the latest task script from the script library, and executes the task script after verifying that the latest task script is valid.

[0055] (6) The executor of the Docker instance executes the task script and returns the log data and the running data of the Kubernetes system to the Web client. The log data is the data generated during the execution of the task script and related to the current task; the running data refers to the CPU availability and usage, memory availability and usage, disk availability and usage, Pod startup time, running status and other data of each node in the Kubernetes system. In the embodiment, the log data and running data are returned to the central node.

[0056] Figure 4 Schematic diagram of the main process of the business system monitoring method based on Kubernetes according to an embodiment of the present invention. Figure 4As shown, the business system monitoring method based on Kubernetes in an embodiment of the present invention mainly includes the following steps:

[0057] Step S401: The business system publishes the image of the application to the image library, submits the task script to the script library, and sends the task request to the Kubernetes system. This step is used to deploy the business system to the Kubernetes system. The specific implementation is: the Web client of the business system publishes the image of the application to the image library, and submits the task script to the script library; the central node of the business system sends the task request to the Kubelet of the Kubernetes system. In an embodiment, the business system can be a scheduling system, an inventory system, a settlement system, etc. The scheduling system can be used to manage scheduled tasks and support the establishment of dependencies between tasks. The task request includes the amount of CPU and memory applied by the business system for the task.

[0058] Step S402: After the Kubernetes system obtains the image of the application, it downloads the latest task script from the script library, executes the downloaded task script, and generates log data and operation data. The Kubernetes Node determines whether the image of the application exists locally. If so, it directly downloads the latest task script from the script library; if not, it pulls the image of the application from the image library and then downloads the latest task script from the script library. The Kubernetes Node executes the downloaded task script to generate log data and node operation data.

[0059] Step S403: The monitoring device collects log data from the database of the business system, determines the task data of the business system during operation based on the log data, and collects the operation data of the Kubernetes system from the etcd of the Kubernetes system. The database of the business system stores the log data generated by the execution task script. After the monitoring device obtains the log data, it can obtain the task data such as the task execution time, task queue time, and the number of waiting tasks through certain calculations. For example, the task execution time is obtained from the task start execution time and the task end execution time in the log data; the task queue time and the number of waiting tasks are obtained from the task dispatch time and the task start execution time in the log data.

[0060] The etcd of the Kubernetes system stores the real-time operation data of the system. The monitoring device can directly obtain the system's CPU availability and usage, memory availability and usage, disk availability and usage and other operation data from etcd by calling the CRI (Container Runtime Interface), CNI (Container Network Interface) and CSI (Container Storage Interface) interfaces of the Kubernetes system. Among them, calling the CRI interface can obtain computing resource information, calling the CNI interface can obtain network resource information, and calling the CSI interface can obtain storage resource information. In an embodiment, the task data and operation data are saved in a database, such as HBase.

[0061] Step S404: The monitoring device matches the task data with the preset first monitoring rule, and matches the operation data with the preset second monitoring rule. The monitoring device supports user-defined monitoring rules, and can match the task data and operation data with the monitoring rules to trigger monitoring warnings. In an embodiment, according to the characteristics of the task data and the operation data, monitoring rules of corresponding dimensions can be set for the task data and the operation data respectively. For a business system, the first monitoring rule can be set based on the task execution time, the task queue time, and the number of waiting tasks; for a Kubernetes system, the second monitoring rule can be set based on the available CPU, the available memory, and the current load quantity.

[0062] Step S405: When the task data meets the alarm triggering condition of the first monitoring rule, and / or the operation data meets the alarm triggering condition of the second monitoring rule, the monitoring warning is triggered. Each monitoring rule is set with a corresponding alarm triggering condition. If the task data or the operation data meets the corresponding alarm triggering condition, the monitoring warning is triggered. The monitoring warning can be triggered by email, internal communication software, text message, phone call, etc., which is used to warn the user. The specific content of the alarm information is set according to the preset rules.

[0063] Taking the task queue length as a dimension, the first monitoring rule may include: if there are more than 20 tasks in the queue and the queue time exceeds 20 minutes, a monitoring warning is triggered. Taking the number of waiting tasks as a dimension, the first monitoring rule may include: if the number of currently waiting tasks is greater than or equal to 30 for three consecutive times, a monitoring warning is triggered. The first monitoring rule includes an alarm triggering condition. Taking the number of waiting tasks as an example, the alarm triggering condition is that the number of currently waiting tasks is greater than or equal to 30 for three consecutive times.

[0064] Taking CPU availability as a dimension, the second monitoring rule may include: if the current CPU availability is less than 30%, a monitoring warning is triggered. Taking memory availability as a dimension, the second monitoring rule may include: if the current memory availability ratio is less than 10% for two consecutive times, a monitoring warning is triggered.

[0065] In the embodiment, the monitoring device polls the database storing the task data and the operation data at a certain frequency (for example, every 60 seconds). The first monitoring rule is illustrated below with reference to Table 1:

[0066] Table 1 shows the number of waiting tasks obtained by the monitoring device in the embodiment.

[0067] The number of pending tasks Collection time 21 2019-04-20-20:44:23 20 2019-04-20-20:45:23 22 2019-04-20-20:46:23 31 2019-04-20-20:47:23 32 2019-04-20-20:48:23 38 2019-04-20-20:49:23 … …

[0068] As shown in Table 1, the number of waiting tasks has exceeded 30 for three consecutive times, so a monitoring warning will be triggered. In the embodiment, the alarm information may be, for example: the number of waiting tasks is greater than or equal to (30) for (3) consecutive times, the latest value of the number of waiting tasks is 38, time: 2019-04-20 20:49:23, sender: big data platform. In the embodiment, if the number of waiting tasks exceeds 30 for two consecutive checks, but is less than 30 for the third check, the count may be restarted.

[0069] Step S406: The monitoring device aggregates the task data and operation data and sends them to the relevant person in charge. The monitoring device aggregates and averages the task data and operation data for a period of time (such as the previous day) and sends the processing results to the relevant person in charge.

[0070] Step S407: The monitoring device calls the label management interface of the Kubernetes system to label the idle resources of the Kubernetes system with the labels of the business system. After the monitoring device triggers the monitoring warning, it will automatically trigger the monitoring self-healing function. The monitoring self-healing function includes: increasing the Kubernetes resources that can be used by the business system, dynamically adjusting the task scheduling order, etc. The monitoring device calls the label management interface of the Kubernetes system to label the idle storage resources and computing resources (referred to as idle resources in the embodiment) in the Kubernetes system with the labels of the business system. Among them, storage resources refer to Docker's disk resources, and computing resources refer to CPU and memory. The purpose of labeling idle resources with the business system is to allow the business system to use the resources.

[0071] Step S408: The monitoring device uses part or all of the idle resources as new resources, and the Kubernetes system allocates the new resources to the tasks to be executed in the business system. The monitoring device obtains the resource usage of each node by requesting the Kubelet API of the Kubernetes system, and then determines the new resources from the idle resources, and the Kubernetes system allocates the new resources to the tasks to be executed in the business system.

[0072] In a preferred embodiment, the monitoring device estimates the target resources required for the tasks to be executed by the business system, and executes the corresponding self-healing plan according to the size of the target resources and the newly added resources. In the embodiment, the monitoring device checks the execution status of the tasks in the waiting queue, summarizes the average resource usage over a period of time (such as the past 7 days), and uses the average resource usage as the target resource. The self-healing plan is as follows:

[0073] If the newly added resources are less than the target resources and the newly added resources can satisfy the high-priority tasks to be executed, the newly added resources will be allocated to the high-priority tasks to be executed, and the high-priority tasks to be executed can be started directly with the newly added resources later; if the newly added resources are less than the target resources and the newly added resources cannot satisfy the high-priority tasks to be executed, the execution status of the running tasks will be evaluated, and according to the execution evaluation results of the running tasks, some of the tasks to be executed will be terminated, and the newly added resources will be allocated to the unterminated tasks to be executed, so that the high-priority tasks can be started quickly and the terminated tasks to be executed are placed at the top of the waiting queue.

[0074] In another preferred embodiment, if there are multiple pending tasks with the same priority, the execution order of these pending tasks can be dynamically adjusted according to the historical running time and resource usage of the pending tasks, giving priority to pending tasks with shorter historical running time or lower resource usage, ensuring that the number of tasks in the waiting queue is reduced. After the self-healing function is triggered, the task leader can be notified by SMS, email, etc., and when the number of tasks in the waiting queue returns to normal, the self-healing solution will immediately become invalid.

[0075] Step S409: The monitoring device graphically displays the task data of the business system and the operating data of the Kubernetes system. The monitoring device uses an open source visualization plug-in to display the task data of the business system and the operating data of the Kubernetes system in the form of a chart, so that the administrator can intuitively view the operating status of the business system and the Kubernetes system. Figure 5 1 is a schematic diagram showing the graphical display results of the business system monitoring method based on Kubernetes according to an embodiment of the present invention. Figure 5As shown in the figure, it shows the memory usage of the Kubernetes system in the past 7 days, the top 10 tasks with low resource utilization, and the top 10 tasks with resource execution timeout.

[0076] It can be seen from the Kubernetes-based business system monitoring method of the embodiment of the present invention that by obtaining the task data of the business system deployed in the Kubernetes system during operation and the operation data of the Kubernetes system, the above data is matched with the preset monitoring rules to trigger monitoring warnings, thereby realizing unified monitoring of the Kubernetes system and the business system; when the task execution or the resource usage of the Kubernetes system is abnormal, the monitoring self-healing function is triggered to adjust the resource allocation to ensure system stability; according to the target resources applied by the business system, the allocation of new resources is adjusted to reduce the impact on the execution of high-priority tasks, realize the linkage between the Kubernetes system and the business system, and improve the efficiency of task resources and Kubernetes unified scheduling; dynamically adjust the execution order of tasks to be executed, give priority to tasks to be executed with a shorter historical running time or lower resource usage, and ensure that the number of tasks to be executed in the queue is reduced.

[0077] Figure 6 Schematic diagram of the main modules of the Kubernetes-based business system monitoring device according to an embodiment of the present invention. Figure 6 As shown, the Kubernetes-based business system monitoring device 600 of the embodiment of the present invention mainly includes:

[0078] The collection module 601 is used to collect the log data generated after the Kubernetes system executes the task script submitted by the business system, and the operation data of the Kubernetes system; wherein the business system is deployed in the Kubernetes system. The business system is deployed to the Kubernetes system, and the Kubernetes system executes the task script submitted by the business system to generate log data. The monitoring device collects the above log data and the operation data of the Kubernetes system.

[0079] The matching module 602 is used to determine the task data of the business system when it is running according to the log data, match the task data with the preset first monitoring rule, and match the operation data with the preset second monitoring rule. The monitoring device obtains the dimensions according to the predetermined task data, and determines the task data of the corresponding dimensions according to the log data. For example, if the dimensions of the task data to be obtained are the task execution time, the task queue time, and the number of waiting tasks, the task data of the above dimensions can be determined based on the log data. In addition, the monitoring device supports user-defined monitoring rules, matches the task data and operation data with the corresponding monitoring rules, and determines whether the task data and operation data meet the corresponding monitoring rules.

[0080] The trigger module 603 is used to trigger a monitoring warning when the task data meets the alarm triggering condition of the first monitoring rule and / or the operation data meets the alarm triggering condition of the second monitoring rule. If the monitoring device determines that any one of the task data and the operation data, or both, meet the corresponding monitoring rules, a monitoring warning is triggered. At this point, unified monitoring of the Kubernetes system and the business system is achieved.

[0081] In addition, the Kubernetes-based business system monitoring device 600 of the embodiment of the present invention may also include: a resource adjustment module, a deployment and operation module, a resource allocation module and a task scheduling module ( Figure 6 The resource adjustment module is used to call the label management interface of the Kubernetes system to label the idle resources of the Kubernetes system with the labels of the business system; and to allocate part or all of the idle resources as new resources to the tasks to be executed of the business system through the Kubernetes system.

[0082] A deployment and operation module is used for the business system to publish the application's image to the image library, submit the task script to the script library, and send the task request to the Kubernetes system; after the Kubernetes system determines that the application's image does not exist locally, it pulls the image from the image library and then downloads the task script from the script library; and the Kubernetes system executes the task script to generate log data.

[0083] A resource allocation module is used to determine the size of the target resources applied by the business system for the tasks to be executed and the newly added resources; if the newly added resources are smaller than the target resources and the newly added resources meet the requirements of the tasks to be executed with a high priority, the newly added resources are allocated to the tasks to be executed with a high priority; and if the newly added resources are smaller than the target resources and the newly added resources do not meet the requirements of the tasks to be executed with a high priority, then according to the execution evaluation results of the running tasks, the designated tasks to be executed are terminated, and the newly added resources are allocated to the tasks to be executed that have not been terminated.

[0084] The task scheduling module is used to dynamically adjust the execution order of the tasks to be executed according to the historical running time and resource usage data of the tasks to be executed when the priorities of multiple tasks to be executed are the same, so as to give priority to the tasks to be executed with short historical running time or low resource usage.

[0085] From the above description, it can be seen that by obtaining the task data of the business system deployed in the Kubernetes system at runtime and the operation data of the Kubernetes system, the above data is matched with the preset monitoring rules to trigger monitoring warnings, thereby realizing unified monitoring of the Kubernetes system and the business system.

[0086] Figure 7 An exemplary system architecture 700 is shown to which a Kubernetes-based business system monitoring method or a Kubernetes-based business system monitoring device according to an embodiment of the present invention can be applied.

[0087] like Figure 7 As shown, system architecture 700 may include terminal devices 701, 702, 703, network 704 and server 705. Network 704 is used to provide a medium for communication links between terminal devices 701, 702, 703 and server 705. Network 704 may include various connection types, such as wired, wireless communication links or optical fiber cables, etc.

[0088] Users can use terminal devices 701, 702, and 703 to interact with server 705 through network 704 to receive or send messages, etc. Various communication client applications can be installed on terminal devices 701, 702, and 703, such as shopping applications, web browser applications, search applications, instant messaging tools, email clients, social platform software, etc.

[0089] The terminal devices 701 , 702 , and 703 may be various electronic devices having a display screen and supporting web browsing, including but not limited to smart phones, tablet computers, laptop computers, and desktop computers.

[0090] The server 705 may be a server that provides various services, such as a background management server that processes the log data provided by the administrator using the terminal devices 701, 702, and 703. The background management server may analyze the received log data and operation data, match them with alarm rules, and feed back the processing results (such as alarm information) to the terminal device.

[0091] It should be noted that the Kubernetes-based business system monitoring method provided in the embodiment of the present application is generally executed by server 705, and accordingly, the Kubernetes-based business system monitoring device is generally set in server 705.

[0092] It should be understood that Figure 7 The number of terminal devices, networks and servers in the embodiment is only for illustration. Any number of terminal devices, networks and servers may be provided according to implementation requirements.

[0093] According to an embodiment of the present invention, the present invention also provides an electronic device and a computer-readable medium.

[0094] The electronic device of the present invention includes: one or more processors; a storage device for storing one or more programs, and when the one or more programs are executed by the one or more processors, the one or more processors implement a business system monitoring method based on Kubernetes according to an embodiment of the present invention.

[0095] The computer-readable medium of the present invention stores a computer program thereon, and when the program is executed by a processor, a business system monitoring method based on Kubernetes in an embodiment of the present invention is implemented.

[0096] Reference below Figure 8 , which shows a schematic diagram of the structure of a computer system 800 suitable for implementing an electronic device of an embodiment of the present invention. Figure 8 The electronic device shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present invention.

[0097] like Figure 8 As shown, the computer system 800 includes a central processing unit (CPU) 801, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 802 or a program loaded from a storage part 808 into a random access memory (RAM) 803. In the RAM 803, various programs and data required for the operation of the computer system 800 are also stored. The CPU 801, the ROM 802, and the RAM 803 are connected to each other via a bus 804. An input / output (I / O) interface 805 is also connected to the bus 804.

[0098] The following components are connected to the I / O interface 805: an input section 806 including a keyboard, a mouse, etc.; an output section 807 including a cathode ray tube (CRT), a liquid crystal display (LCD), etc., and a speaker, etc.; a storage section 808 including a hard disk, etc.; and a communication section 809 including a network interface card such as a LAN card, a modem, etc. The communication section 809 performs communication processing via a network such as the Internet. A drive 810 is also connected to the I / O interface 805 as needed. A removable medium 811, such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, etc., is installed on the drive 810 as needed, so that a computer program read therefrom is installed into the storage section 808 as needed.

[0099] In particular, according to the embodiments disclosed in the present invention, the process described in the main step diagram above can be implemented as a computer software program. For example, the embodiments disclosed in the present invention include a computer program product, which includes a computer program carried on a computer-readable medium, and the computer program includes a program code for executing the method shown in the main step diagram. In such an embodiment, the computer program can be downloaded and installed from the network through the communication part 809, and / or installed from the removable medium 811. When the computer program is executed by the central processing unit (CPU) 801, the above-mentioned functions defined in the system of the present invention are executed.

[0100] It should be noted that the computer-readable medium shown in the present invention may be a computer-readable signal medium or a computer-readable storage medium or any combination of the above two. The computer-readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer 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. In the present invention, a computer-readable storage medium may be any tangible medium containing or storing a program that can be used by or in combination with an instruction execution system, device or device. In the present invention, a computer-readable signal medium may include a data signal propagated in a baseband or as part of a carrier wave, which carries a computer-readable program code. This propagated data signal may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. Computer-readable signal media may also be any computer-readable medium other than computer-readable storage media, which may send, propagate or transmit a program for use by or in conjunction with an instruction execution system, apparatus or device. The program code contained on the computer-readable medium may be transmitted using any appropriate medium, including but not limited to: wireless, wire, optical cable, RF, etc., or any suitable combination of the above.

[0101] The flow chart and block diagram in the accompanying drawings illustrate the possible architecture, function and operation of the system, method and computer program product according to various embodiments of the present invention. In this regard, each box in the flow chart or block diagram can represent a module, a program segment, or a part of a code, and the above-mentioned module, program segment, or a part of a code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a different order from the order marked in the accompanying drawings. For example, two boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram or flow chart, and the combination of the boxes in the block diagram or flow chart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.

[0102] The modules involved in the embodiments of the present invention may be implemented in software or hardware. The modules described may also be provided in a processor, for example, may be described as: a processor including a collection module, a matching module and a trigger module. Among them, the names of these modules do not constitute a limitation on the module itself in certain cases, for example, the collection module may also be described as "a module for collecting log data generated after the Kubernetes system executes the task script submitted by the business system, as well as the operation data of the Kubernetes system".

[0103] As another aspect, the present invention also provides a computer-readable medium, which may be included in the device described in the above embodiment; or it may exist independently without being assembled into the device. The above computer-readable medium carries one or more programs. When the above one or more programs are executed by a device, the device includes: collecting log data generated after the Kubernetes system executes the task script submitted by the business system, and the operation data of the Kubernetes system; wherein the business system is deployed in the Kubernetes system; determining the task data when the business system is running according to the log data, matching the task data with the preset first monitoring rule, and matching the operation data with the preset second monitoring rule; when the task data meets the alarm triggering condition of the first monitoring rule, and / or the operation data meets the alarm triggering condition of the second monitoring rule, triggering the monitoring warning.

[0104] From the above description, it can be seen that by obtaining the task data of the business system deployed in the Kubernetes system at runtime and the operation data of the Kubernetes system, the above data is matched with the preset monitoring rules to trigger monitoring warnings, thereby realizing unified monitoring of the Kubernetes system and the business system.

[0105] The above product can execute the method provided by the embodiment of the present invention, and has the functional modules and beneficial effects corresponding to the execution method. For technical details not described in detail in this embodiment, please refer to the method provided by the embodiment of the present invention.

[0106] The above specific implementations do not constitute a limitation on the protection scope of the present invention. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions may occur depending on design requirements and other factors. Any modification, equivalent substitution and improvement made within the spirit and principle of the present invention shall be included in the protection scope of the present invention.

Claims

1. A business system monitoring method based on Kubernetes, characterized in that: include: The business system publishes the application image to the image library, submits the task script to the script library, and sends the task request to the Kubernetes system to deploy the business system in the Kubernetes system; the application refers to the computer program code corresponding to each task of the business system; Collect log data generated after the Kubernetes system executes the task script submitted by the business system, as well as the operation data of the Kubernetes system; Determine task data when the business system is running according to the log data, match the task data with a preset first monitoring rule, and match the running data with a preset second monitoring rule; When the task data meets the alarm triggering condition of the first monitoring rule, and / or the operation data meets the alarm triggering condition of the second monitoring rule, triggering a monitoring warning; Triggering the monitoring self-healing function to call the label management interface of the Kubernetes system to label the idle resources of the Kubernetes system with the label of the business system; Part or all of the idle resources are used as new resources and allocated to the tasks to be executed by the business system through the Kubernetes system; wherein, by requesting the Kubelet API of the Kubernetes system, the resource usage of each node is obtained, and then the new resources are determined from the idle resources; The tasks to be executed assigned to the business system by the Kubernetes system include: determining the target resources applied by the business system for the tasks to be executed and the size of the newly added resources; wherein, the execution status of the tasks in the waiting queue is checked, the average resource usage in a preset time is summarized, and the average resource usage is used as the target resource; If the newly added resources are less than the target resources and the newly added resources satisfy the tasks to be executed with a high priority, the newly added resources are allocated to the tasks to be executed with a high priority; If the newly added resources are less than the target resources and the newly added resources do not meet the requirements of the high-priority tasks to be executed, then according to the execution evaluation results of the running tasks, the designated tasks to be executed are terminated and the newly added resources are allocated to the unterminated tasks to be executed.

2. The method according to claim 1, characterized in that The log data generated after the Kubernetes system executes the task script submitted by the business system includes: After the Kubernetes system determines that the image of the application does not exist locally, it pulls the image from the image library, and then downloads the task script from the script library; The Kubernetes system executes the task script to generate log data.

3. The method according to claim 1, characterized in that The method further comprises: If the priorities of multiple tasks to be executed are the same, the execution order of the tasks to be executed is dynamically adjusted according to the historical running time and resource usage data of the tasks to be executed, so as to give priority to the tasks to be executed with short historical running time or low resource usage.

4. A business system monitoring device based on Kubernetes, characterized in that: include: A deployment and operation module, which is used for the business system to publish the image of the application to the image library, submit the task script to the script library, and send the task request to the Kubernetes system to deploy the business system in the Kubernetes system; wherein the application refers to the computer program code corresponding to each task of the business system; A collection module, used to collect log data generated after the Kubernetes system executes the task script submitted by the business system, as well as the operation data of the Kubernetes system; wherein the business system is deployed in the Kubernetes system; A matching module, used to determine the task data of the business system when it is running according to the log data, match the task data with a preset first monitoring rule, and match the running data with a preset second monitoring rule; A trigger module, configured to trigger a monitoring warning when the task data meets the alarm triggering condition of the first monitoring rule and / or the operation data meets the alarm triggering condition of the second monitoring rule; A resource adjustment module is used to trigger the monitoring self-healing function to call the label management interface of the Kubernetes system to label the idle resources of the Kubernetes system with the labels of the business system; and to allocate part or all of the idle resources as new resources to the tasks to be executed of the business system through the Kubernetes system; wherein, by requesting the Kubelet API of the Kubernetes system, the resource usage of each node is obtained, and then the new resources are determined from the idle resources; The tasks to be executed assigned to the business system by the Kubernetes system include: determining the target resources applied by the business system for the tasks to be executed and the size of the newly added resources; wherein, the execution status of the tasks in the waiting queue is checked, the average resource usage in a preset time is summarized, and the average resource usage is used as the target resource; If the newly added resources are less than the target resources and the newly added resources satisfy the tasks to be executed with a high priority, the newly added resources are allocated to the tasks to be executed with a high priority; If the newly added resources are less than the target resources and the newly added resources do not meet the requirements of the high-priority tasks to be executed, then according to the execution evaluation results of the running tasks, the designated tasks to be executed are terminated and the newly added resources are allocated to the unterminated tasks to be executed.

5. The device according to claim 4, characterized in that The device also includes: a deployment and operation module, which is also used for: After the Kubernetes system determines that the image of the application does not exist locally, it pulls the image from the image library, and then downloads the task script from the script library; and The Kubernetes system executes the task script to generate log data.

6. An electronic device, characterized in that: include: one or more processors; a storage device for storing one or more programs, When the one or more programs are executed by the one or more processors, the one or more processors implement the method according to any one of claims 1 to 3.

7. A computer readable medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the method according to any one of claims 1 to 3 is implemented.