A method and system for performing abnormal scanning on applications of a kubernetes cluster

By introducing the system of scanning task manager, task actuator, and scanning result analyzer in the Kubernetes cluster, the unable to effectively detect and repair the abnormal problems of the Kubernetes cluster application and components in existing technology, realized fast, simple abnormal abnormalities Scanning and repairing suggestions are recommended.

CN114564326BActive Publication Date: 2025-01-24SINA TECH (CHINA) CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202210134259.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-02-14
Publication Date
2025-01-24
Estimated Expiration
2042-02-14

AI Technical Summary

Technical Problem

The prior art cannot effectively detect and repair exceptions for applications and kubernetes components in kubernetes clusters, especially when services and components may experience abnormal exits during business migration containers.

Method used

Provide a method and system to obtain the scanning task by scanning the task manager, and use a built -in or customized scan program to scan the application in the Kubernetes cluster. The system includes scan task manager, task actuator, and scanning results analyzer. It can handle built -in and custom tasks, analyze the scanning results and generate repair suggestions.

Benefits of technology

The fast, simple and abnormal scanning of all applications in the Kubernetes cluster can detect the problems that may exist in the application, and provide repair suggestions to improve the scalability and efficiency of the system.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114564326B_ABST
    Figure CN114564326B_ABST
Patent Text Reader

Abstract

The embodiment of the present invention provides a method and system for performing abnormal scanning on applications of a kubernetes cluster, including: a scanning task manager obtains a scanning task for performing abnormal scanning on applications of a kubernetes cluster, and checks a scanning program set in the scanning task; the task type of the scanning task is a built-in task or a custom task; when the scanning program passes the check, the scanning program is run by a task executor specified in the scanning task to scan the specified kubernetes cluster application; a scanning result analyzer determines whether to generate a modification suggestion according to the scanning result. All applications in the kubernetes cluster are scanned quickly and simply to check for possible problems in the application.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of kubernetes clusters, and in particular to a method and system for performing abnormal scanning on an application program of a kubernetes cluster. Background Art

[0002] In the process of business migration container, it is necessary to use kubernetes orchestration tools to deploy container services. In reality, there are many online kubernetes clusters, many services deployed, and many kubernetes components used to support services running on kubernetes. These services and kubernetes components are also applications. These programs may inevitably encounter abnormal exit situations. At this time, a system and method are needed to detect these anomalies and provide repair suggestions to managers or application developers. In the existing technology, only some of them are checked separately for business applications or kuberentes software itself, and cannot support the inspection of these services and kubernetes components. Summary of the invention

[0003] The embodiment of the present invention provides a method and system for performing abnormal scanning on an application program of a Kubernetes cluster, which can quickly and simply scan all the applications in the Kubernetes cluster and check for possible problems of the applications.

[0004] To achieve the above object, on the one hand, an embodiment of the present invention provides a method for performing abnormal scanning on an application of a Kubernetes cluster, comprising:

[0005] The scanning task manager obtains a scanning task for performing abnormal scanning on an application of a kubernetes cluster, and checks a scanning program set in the scanning task; the task type of the scanning task is a built-in task or a custom task; wherein the application of the kubernetes cluster includes at least one of the following: software for building the kubernetes cluster itself, a service deployed in the kubernetes cluster, a kubernetes component supporting the operation of a service, and a business application on the kubernetes cluster;

[0006] When the scanning program passes the check, the scanning program is run by the task executor specified in the scanning task to scan the application of the specified kubernetes cluster; the scanning program is run by the task executor specified in the scanning task to scan the application of the specified kubernetes cluster, specifically including:

[0007] If the task type in the scan task is a built-in task, the built-in task scanner corresponding to the built-in task is run, and the application of the specified kubernetes cluster is scanned by the built-in task scanner. After scanning the application of the specified kubernetes cluster, the scan result is obtained;

[0008] If the task type in the scanning task is a custom task, the programming language used by the custom task scanner is analyzed; if the programming language used by the custom task scanner is a preset language, the running environment corresponding to the preset language is called to run the custom task scanner; the application of the specified kubernetes cluster is scanned by the custom task scanner, and the scanning result is obtained after scanning the application of the specified kubernetes cluster;

[0009] If the programming language used by the custom task scanner is a non-preset language, the code of the custom task scanner is compiled into a code of a recognizable language, and the running environment that responds to the recognizable language is called to run the custom task scanner compiled into the recognizable language; the application of the specified kubernetes cluster is scanned by the scanner compiled into the recognizable language, and the scanning result is obtained after scanning the application of the specified kubernetes cluster;

[0010] The scan result analyzer determines whether to generate modification suggestions based on the scan results.

[0011] On the other hand, an embodiment of the present invention provides a system for performing abnormal scanning on an application of a Kubernetes cluster, including:

[0012] A scanning task manager is used to obtain a scanning task for performing abnormal scanning on an application of a kubernetes cluster, and check a scanning program set in the scanning task; the task type of the scanning task is a built-in task or a custom task; wherein the application of the kubernetes cluster includes at least one of the following: software for building the kubernetes cluster itself, services deployed on the kubernetes cluster, kubernetes components supporting service operation, and business applications on the kubernetes cluster;

[0013] The task executor is specified in the scanning task and is used to run the scanning program to scan the application of the specified kubernetes cluster when the scanning program passes the check; the task executor is specifically used to:

[0014] If the task type in the scan task is a built-in task, the built-in task scanner corresponding to the built-in task is run, and the application of the specified kubernetes cluster is scanned by the built-in task scanner. After scanning the application of the specified kubernetes cluster, the scan result is obtained;

[0015] If the task type in the scanning task is a custom task, the programming language used by the custom task scanner is analyzed; if the programming language used by the custom task scanner is a preset language, the running environment corresponding to the preset language is called to run the custom task scanner; the application of the specified kubernetes cluster is scanned by the custom task scanner, and the scanning result is obtained after scanning the application of the specified kubernetes cluster;

[0016] If the programming language used by the custom task scanner is a non-preset language, the code of the custom task scanner is compiled into a code of a recognizable language, and the running environment that responds to the recognizable language is called to run the custom task scanner compiled into the recognizable language; the application of the specified kubernetes cluster is scanned by the scanner compiled into the recognizable language, and the scanning result is obtained after scanning the application of the specified kubernetes cluster;

[0017] The scan result analyzer is used to determine whether to generate modification suggestions based on the scan results.

[0018] The above technical solution has the following beneficial effects: quickly and easily scan all applications in the Kubernetes cluster to check for possible problems with the applications. BRIEF DESCRIPTION OF THE DRAWINGS

[0019] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0020] Figure 1 It is a flow chart of a method for performing abnormal scanning on an application of a kubernetes cluster according to an embodiment of the present invention;

[0021] Figure 2 This is a structural diagram of a system for performing abnormal scanning on an application of a kubernetes cluster according to an embodiment of the present invention;

[0022] Figure 3The present invention is a flowchart of another method for performing abnormality scanning on an application of a Kubernetes cluster according to an embodiment. DETAILED DESCRIPTION

[0023] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0024] like Figure 1 As shown, in combination with an embodiment of the present invention, a method for performing abnormal scanning on an application of a kubernetes cluster is provided, comprising:

[0025] S101: The scanning task manager obtains a scanning task for performing abnormal scanning on an application of a kubernetes cluster, and checks a scanning program set in the scanning task; the task type of the scanning task is a built-in task or a custom task; wherein the application of the kubernetes cluster includes at least one of the following: software for building the kubernetes cluster itself, a service deployed in the kubernetes cluster, a kubernetes component supporting the operation of a service, and a business application on the kubernetes cluster;

[0026] S102: When the scanning program passes the check, the scanning program is run by the task executor specified in the scanning task to scan the application of the specified kubernetes cluster; step 102 specifically includes:

[0027] S1021: if the task type in the scanning task is a built-in task, a built-in task scanning program corresponding to the built-in task is run, and an application of a specified kubernetes cluster is scanned by the built-in task scanning program, and a scanning result is obtained after scanning the application of the specified kubernetes cluster;

[0028] S1022: if the task type in the scanning task is a custom task, analyzing the programming language used by the custom task scanning program; if the programming language used by the custom task scanning program is a preset language, calling the running environment corresponding to the preset language to run the custom task scanning program; scanning the application of the specified kubernetes cluster through the custom task scanning program, and obtaining the scanning result after scanning the application of the specified kubernetes cluster;

[0029] S1023: if the programming language used by the custom task scanner is a non-preset language, compile the code of the custom task scanner into a code of a recognizable language, call the operating environment that responds to the recognizable language to run the custom task scanner compiled into the recognizable language; scan the application of the specified kubernetes cluster by using the scanner compiled into the recognizable language, and obtain the scanning result after scanning the application of the specified kubernetes cluster;

[0030] S103: The scanning result analyzer determines whether to generate a modification suggestion according to the scanning result.

[0031] Preferably, in step 101, the scanning task manager obtains a scanning task for performing anomaly scanning on an application of a kubernetes cluster, specifically including:

[0032] S1011: The scanning task manager obtains a defined scanning task for performing abnormal scanning on an application of a kubernetes cluster from a user interaction interface, wherein the user interaction interface is used to generate a scanning task for performing abnormal scanning on an application of a kubernetes cluster, modify a scanning task for performing abnormal scanning on an application of a kubernetes cluster, delete a scanning task for performing abnormal scanning on an application of a kubernetes cluster, and / or query a scanning task for performing abnormal scanning on an application of a kubernetes cluster;

[0033] In step 101, the scanning task manager checks the scanning program set in the scanning task, specifically including:

[0034] S1012: If the task type in the scanning task is a built-in task, the scanning task manager checks whether the data of the built-in task scanning program corresponding to the built-in task conforms to the format; if the task type in the scanning task is a custom task, the scanning task manager checks whether the custom task scanning program conforms to the preset format and conforms to the syntax specification of the programming language;

[0035] S1013: If the scanning program passes the check, the scanning task is saved; if the scanning program fails the check, the reason for the check failure is returned.

[0036] Preferably, it also includes:

[0037] S104: Each task executor registers with a storage component in the scanning task memory when it is generated, and declares its own label when registering. The task executor label includes: the identification of the task executor, the area where the task executor is located, the computer room where the task executor is located, and the number of hardware resources of the task executor itself; wherein the scanning task memory includes two storage components;

[0038] In step 1013, if the scanning program passes the check, the scanning task is saved, which specifically includes:

[0039] The scanning task memory obtains the scanning tasks that have passed the inspection, and adds all the scanning tasks that have passed the inspection to two storage components in the scanning task memory; for the storage components, when the storage components are upgraded, the two storage components are upgraded in turn, and when one storage component is upgraded, the other storage component runs and has storage function; and when the storage software entity connected to the storage component changes, the two storage components adapt to the interface or middleware of the changed storage software entity in turn; wherein the storage component contacts the storage software entity through the interface or middleware.

[0040] Preferably, it also includes:

[0041] S105: The task acquirer obtains the scanning task from the running storage component at a regular interval, obtains the region where the task executor in the scanning task is located, allocates the task executor that matches the region to the scanning task, adds the allocated task executor tag to the scanning task to form an updated scanning task, and sends the updated scanning task to the task distributor;

[0042] S106: The task distributor analyzes the updated scan task to obtain the task executor identification, and the task distributor determines whether the task executor in the scan task has the ability to operate normally according to the monitoring situation of each task executor;

[0043] S107: When the task executor in the scanning task has the ability to operate normally, the updated scanning task is sent to the assigned task executor.

[0044] Preferably, when there are at least two identical clusters, a scan is performed on each identical cluster in the scan task, and a task executor is separately set for each cluster;

[0045] After scanning the application of the specified kubernetes cluster and obtaining the scanning result, it also includes:

[0046] S108: Send the scanning result to the data collector;

[0047] S109: The data collector formats the scan result into a json format; and sends the scan result in the json format to a scan result analyzer; wherein the scan results returned by multiple task executors of the same scan task are aggregated, and the aggregated scan results are formatted into a json format;

[0048] In step 103, the scanning result analyzer determines whether to generate modification suggestions according to the scanning results, which specifically includes:

[0049] S1031: When there are at least two completely identical kubernetes clusters, the scan result analyzer analyzes each scan result in the json format. If all the scan results in the json format are consistent, the scan result is sent to the suggestion generator, which generates a repair suggestion and saves it for display; if the scan results in the json format are inconsistent, the scan result is saved for display;

[0050] S1032: When there are not at least two identical Kubernetes clusters, the scan result analyzer sends the scan result to the suggestion generator, which generates a repair suggestion and saves it for display.

[0051] like Figure 2 As shown, in combination with an embodiment of the present invention, a system for performing abnormal scanning on an application of a kubernetes cluster is provided, comprising:

[0052] The scanning task manager 21 is used to obtain a scanning task for performing abnormal scanning on the application of the kubernetes cluster, and check the scanning program set in the scanning task; the task type of the scanning task is a built-in task or a custom task; wherein the application of the kubernetes cluster includes at least one of the following: software for building the kubernetes cluster itself, services deployed in the kubernetes cluster, kubernetes components supporting service operation, and business applications on the kubernetes cluster;

[0053] The task executor 22 is specified in the scanning task and is used to run the scanning program to scan the application of the specified kubernetes cluster when the scanning program passes the check; the task executor 22 is specifically used to:

[0054] If the task type in the scan task is a built-in task, the built-in task scanner corresponding to the built-in task is run, and the application of the specified kubernetes cluster is scanned by the built-in task scanner. After scanning the application of the specified kubernetes cluster, the scan result is obtained;

[0055] If the task type in the scanning task is a custom task, the programming language used by the custom task scanner is analyzed; if the programming language used by the custom task scanner is a preset language, the running environment corresponding to the preset language is called to run the custom task scanner; the application of the specified kubernetes cluster is scanned by the custom task scanner, and the scanning result is obtained after scanning the application of the specified kubernetes cluster;

[0056] If the programming language used by the custom task scanner is a non-preset language, the code of the custom task scanner is compiled into a code of a recognizable language, and the running environment that responds to the recognizable language is called to run the custom task scanner compiled into the recognizable language; the application of the specified kubernetes cluster is scanned by the scanner compiled into the recognizable language, and the scanning result is obtained after scanning the application of the specified kubernetes cluster;

[0057] The scanning result analyzer 23 is used to determine whether to generate a modification suggestion according to the scanning result.

[0058] Preferably, the system further comprises a user interaction interface 24, wherein:

[0059] The scanning task manager 21 is specifically used for:

[0060] Obtain the defined scanning task for performing abnormal scanning on the application of the Kubernetes cluster from the user interface;

[0061] The user interaction interface 24 is used to generate a scanning task for performing anomaly scanning on an application of a kubernetes cluster, modify a scanning task for performing anomaly scanning on an application of a kubernetes cluster, delete a scanning task for performing anomaly scanning on an application of a kubernetes cluster, and / or query a scanning task for performing anomaly scanning on an application of a kubernetes cluster;

[0062] The scanning task manager 21 is specifically used for:

[0063] If the task type in the scanning task is a built-in task, check whether the data of the built-in task scanner corresponding to the built-in task conforms to the format; if the task type in the scanning task is a custom task, check whether the custom task scanner conforms to the preset format and the syntax specification of the programming language;

[0064] If the scanner passes the check, the scanning task is saved; if the scanner fails the check, the reason for the failure is returned.

[0065] Preferably, the system further comprises a scanning task memory 25, wherein the scanning task memory comprises two storage components, and the task executor comprises at least two, wherein:

[0066] Each task executor 22 is used to register with the storage component provided in the scanning task storage when it is generated, and declare its own label when registering, and the task executor label includes: the identification of the task executor, the area where the task executor is located, the computer room where the task executor is located, and the number of hardware resources of the task executor itself;

[0067] The scanning task memory 25 is used to obtain the scanning tasks that have passed the inspection, and add the scanning tasks that have passed the inspection to the two storage components in the scanning task memory; for the storage components, when the storage components are upgraded, the two storage components are upgraded in turn, and when one storage component is upgraded, the other storage component runs and has storage function; and when the storage software entity connected to the storage component changes, the two storage components adapt to the interface or middleware of the changed storage software entity in turn; wherein the storage component contacts the storage software entity through the interface or middleware.

[0068] Preferably, it also includes a task acquirer 26 and a task distributor 30, wherein:

[0069] The task acquirer 26 is used to acquire the scanning task by the storage component running automatically at a scheduled time, acquire the area where the task executor in the scanning task is located, assign the task executor that matches the area to the scanning task, add the assigned task executor tag to the scanning task to form an updated scanning task, and send the updated scanning task to the task distributor;

[0070] The task distributor 30 is used to receive the updated scanning task, analyze the updated scanning task to obtain the task executor identification, and determine whether the task executor in the scanning task has the ability to operate normally according to the monitoring situation of each task executor;

[0071] When the task executor in the scan task is capable of normal operation, the updated scan task is sent to the task executor.

[0072] Preferably, when there are at least two identical Kubernetes clusters, a scan task is set to scan each identical cluster, and a task executor is set separately for each cluster;

[0073] The system for performing anomaly scanning on an application of a kubernetes cluster further includes a data collector 27 and a suggestion generator 29, wherein:

[0074] The data collector 27 is used to obtain the scanning result after scanning the application of the specified kubernetes cluster and receive the scanning result;

[0075] Format the scan result into json format; send the scan result in json format to the scan result analyzer; wherein, aggregate the scan results returned by multiple task executors of the same scan task, and format the aggregated scan results into json format;

[0076] The scan result analyzer 23 is specifically used to analyze each scan result in the json format when there are at least two identical kubernetes clusters, and if all the scan results in the json format are consistent, send the scan result to the suggestion generator; if the scan results in the json format are inconsistent, save the scan result for display;

[0077] When there are no at least two identical Kubernetes clusters, the scan results are sent to the suggestion generator;

[0078] The suggestion generator 29 is used to generate a repair suggestion according to the received scanning result and save it for display.

[0079] The beneficial effects achieved by the embodiments of the present invention are as follows:

[0080] 1. Provide a user scanning task management interface to visually manage user scanning tasks.

[0081] 2. This system can be used to quickly and easily scan all applications in the Kubernetes cluster to check for possible problems in the applications. The prior art only scans business applications and Kubernetes software itself, does not support services deployed in the Kubernetes cluster, and does not support scanning of Kubernetes components running on Kubernetes (these services and Kubernetes components are also applications). It also does not support user-defined scanning programs. The present invention can scan all applications including the cluster's own applications, so that anomalies including those of the cluster's own applications can be discovered.

[0082] 3. According to the scanning results, repair suggestions are provided for applications that may have problems, and the applications are optimized through the repair suggestions. In the prior art, there is no classification and summary of the scanned data, and no repair suggestions are given.

[0083] 4. Supports running user-defined programs in scanning tasks, with great scalability.

[0084] The above technical solution of the embodiment of the present invention is described in detail below in conjunction with specific application examples. For technical details not introduced during the implementation process, please refer to the relevant description in the previous text.

[0085] The technical abbreviations involved in the present invention are explained as follows:

[0086] Kubernetes: A container orchestration management tool

[0087] Kubernetes cluster: contains all components of the Kubernetes software and the servers that run these components.

[0088] Applications on Kubernetes: Services deployed using Kubernetes, such as nginx service, mysql service, etc.

[0089] Kubernetes resources: such as deployment, server, ingress, etc., which are used to deploy services on Kubernetes

[0090] Kubernetes ecosystem software: such as Prometheus monitoring system, Alert Manager alarm system, Helm management tool, etc.

[0091] Container: A container image is a lightweight, independent executable package of software that contains everything needed to run it: code, runtime, system tools, system libraries, settings, etc. A container is the running state of a program in a container.

[0092] The present invention is a method and system for scanning anomalies of a kubernetes application, and the technical field relates to containers, cloud computing kubernetes orchestration, etc. The system includes multiple components, each of which is responsible for a part of the function.

[0093] The system has 10 built-in scanning programs that users can use directly, namely:

[0094] 1. Scan the registry in the deployment, daemonset, and statefulset in the kubernetes cluster to see if they can be connected.

[0095] 2. Scan deployment, daemonset, and statefulset to see if readness probe and livesness probe are configured.

[0096] 3. Check whether the pod has request and limit configurations.

[0097] 4. Check whether the service is in pending status and whether the pod is in pending status.

[0098] 5. Check whether the ingress is configured and has a reasonable body size, headersize, etc., and check whether a reasonable domain name is configured.

[0099] 6. Check whether the plain text user and password are configured in configmap.

[0100] 7. Check whether any pod on the node consumes too much CPU file descriptors, memory, and bandwidth.

[0101] 8. Check whether HPA triggers the scaling limit.

[0102] 9. Check whether the image configured in the pod exceeds the maximum size, and check whether the basic system image layer that the image depends on exists on the node.

[0103] 10. Custom scan, execute custom programs (golang, shell, python) (shell python executes directly, golang program is compiled first, then run).

[0104] like Figure 3 As shown:

[0105] 1. Task executor (multiple). The function of this component is that the task executor registers with the storage component when it is generated and declares its own label. The task executor label includes: the identification of the task executor, the region where the task executor is located, the computer room where the task executor is located, and the number of hardware resources of the task executor itself. For example, the label includes which region the task executor is located in (regional parameters such as East China, South China, Northeast China, and Central China) (the label is to record the location of the executor, so that it is easy to know which executor it is), the label includes which IDC computer room the task executor is located in (Telecom Computer Room 1, Mobile Computer Room 2, Unicom Computer Room 3) (it can be known in which computer room the task is executed. The same type of task will be executed in multiple task executors), and the label includes the number of its own hardware resources (how many CPUs, how much memory, how much disk space, etc.). The registration process is as follows: Figure 3 As shown in step 0.

[0106] This component contains the shell python language running environment, which can directly run programs in these two languages. This component contains the golang language compilation environment, which can directly compile and run the golang language program code.

[0107] (1) A scanning task is similar to the following:

[0108] Task name: Test Task 1

[0109] Select Task Executor: Region = "North China, South China"

[0110] Select built-in task: built-in task id = "1, 2, 5"

[0111] Custom task language: "python"

[0112] Custom task code: "some code content"

[0113] Task executor list: "Leave it blank" / / Assign a task executor to the task acquirer

[0114] (2) The task executor receives a task from the task distributor, and the task type of the scanning task is a built-in task or a custom task. If the task type in the scanning task is a built-in task, the built-in task scanning program corresponding to the built-in task is run, and the application of the specified kubernetes cluster is scanned by the built-in task scanning program, and the scanning result is obtained after scanning the application of the specified kubernetes cluster. That is, if it is a built-in task, the built-in inspection program corresponding to the task can be directly executed. Among them, the application of the kubernetes cluster includes at least one of the following: software for building the kubernetes cluster itself, services deployed on the kubernetes cluster, kubernetes components that support service operation, and business applications on the kubernetes cluster.

[0115] If it is a user-defined task, analyze what language the task is in. First: If the task type in the scan task is a custom task, analyze the programming language used by the custom task scanner; if the programming language used by the custom task scanner is a preset language, call the runtime environment corresponding to the preset language to run the custom task scanner; scan the application of the specified kubernetes cluster through the custom task scanner, and get the scan result after scanning the application of the specified kubernetes cluster. For example, if it is shell or python, call the runtime environment of the corresponding language to run the inspection program.

[0116] If the programming language used by the custom task scanner is a non-preset language, the code of the custom task scanner is compiled into a code of a recognizable language, and the operating environment that responds to the recognizable language is called to run the custom task scanner compiled into the recognizable language; the application of the specified kubernetes cluster is scanned by the scanner compiled into the recognizable language, and the scanning result is obtained after scanning the application of the specified kubernetes cluster. For example, if it is in golang language, the user-defined task code is compiled and then run. When there are at least two identical kubernetes clusters, each identical kubernetes cluster is scanned in the scanning task, and a task executor is set separately for each kubernetes cluster.

[0117] (3) After the task executor completes the task, it sends the execution result to the data collector, such as Figure 3 As shown in step 7.

[0118] 2. User interaction interface. The function of this component is to add, delete, modify, and query scan tasks. The data submitted by the user through the interface will be submitted to the scan task manager. Figure 3 As shown in step 1, the processing suggestions for the scan results are also obtained from the suggestion extractor, such as Figure 3 As shown in step 11. That is, the user interaction interface is used to generate a scanning task for performing anomaly scanning on an application of a kubernetes cluster, modify a scanning task for performing anomaly scanning on an application of a kubernetes cluster, delete a scanning task for performing anomaly scanning on an application of a kubernetes cluster, and / or query a scanning task for performing anomaly scanning on an application of a kubernetes cluster.

[0119] 3. Scanning task manager, which obtains the scanning task for abnormal scanning of the application of the kubernetes cluster from the user interaction interface. At this time, the user's scanning task will be checked, including built-in tasks and user-defined scanning programs.

[0120] The built-in task checks whether the data submitted by the user complies with the format, that is, if the task type in the scan task is a built-in task, the scan task manager checks whether the data of the built-in task scanner corresponding to the built-in task complies with the format.

[0121] User-defined tasks are checked for compliance with the format and syntax of the programming language. That is, if the task type within the scan task is a custom task, the scan task manager checks whether the custom task scanner complies with the preset format and syntax of the programming language.

[0122] If the check passes, the scan task memory is submitted, such as Figure 3 As shown in step 2, if the check fails, the failure reason is returned to the user, prompting him to make changes. 4. Scan task storage, this component accepts the scan task and adds the scan task to the storage component, such as Figure 3 As shown in step 3, the scanning task memory includes two storage components. When the storage components are upgraded, the two storage components are upgraded in turn. When one storage component is upgraded, the other storage component is running and has storage function; that is, the storage component is divided into two parts, one is online and the other is used as a backup. The scanning task memory operates these two parts at the same time. The function of this component is to ensure the interface adaptation work after the storage component of this system is upgraded in the future, so that the user can use the new storage component without modifying the scanning task. When the storage software entity connected to the storage component changes, the two storage components adapt to the interface or middleware of the changed storage software entity in turn; wherein, the storage component contacts the storage software entity through the interface or middleware. Specifically, the storage component itself may also need to upgrade the version. When it is upgraded, there is a backup, so it can be upgraded alternately. In addition, the storage component also contacts the storage software entity through the interface or middleware. When the storage software entity changes, there is no need to rewrite the entire storage component, only the new storage software entity interface needs to be adapted.

[0123] 5. Task acquirer: This component acquires tasks from the storage component at regular intervals. According to the characteristics of the task, it acquires the regional label and other attributes of the task, and assigns the task to a task executor. That is, it assigns a task executor that matches the region to the scanning task, and adds the assigned task executor label to the scanning task to form an updated scanning task. Then the scanning task is sent to the task distributor. Figure 3 As shown in step 4.

[0124] 6. Task distributor: The task distributor receives the scanning task from the task acquirer, analyzes the task executor in the task description, and sends the corresponding task to the task executor. The task distributor determines whether the task executor in the scanning task has the ability to operate normally based on the monitoring of each task executor; when the task executor in the scanning task has the ability to operate normally, the updated scanning task is sent to the assigned task executor.

[0125] 7. Data Collector: This component collects the running results of the scanning tasks of the task executor (multiple) and formats the running results. It also aggregates the results returned by multiple task executors of the same scanning task into a json format and sends it to the scanning result analyzer. Figure 3As shown in step 8. The reason for multiple task executors for the same scan task is that the clusters are separate, and there can be more than two identical clusters, so the same task needs to be run on both. Specifically, the data collector formats the scan results into json format; sends the scan results in json format to the scan result analyzer; wherein, the scan results returned by multiple task executors of the same scan task are aggregated, and the aggregated scan results are formatted into json format.

[0126] 8. Scan result analyzer. The scan result analyzer splits a scan result in json format. If all scan results in a json are consistent, they will be analyzed by the suggestion generator. If they are inconsistent, no suggestions can be given. Please judge the scan results yourself. Figure 3 As shown in step 9

[0127] 9. Suggestion generator. This component receives the scan results from the scan result analyzer. When there are at least two identical Kubernetes clusters, the scan result analyzer analyzes the scan results in JSON format. For scan tasks that are inconsistent with the scan results, no suggestions are given and they are directly stored in the storage component for users to judge later. For scan results that are consistent, the repair suggestions for the corresponding built-in tasks prepared in advance are added to the storage component, such as Figure 3 As shown in step 10.

[0128] When there are no at least two identical Kubernetes clusters, the scan result analyzer sends the scan results to the suggestion generator, which generates repair suggestions and saves them for display.

[0129] 10. The suggestion extractor extracts the scanning results and suggestions of the corresponding scanning task from the storage component and returns them to the user interaction interface for the user to judge and repair.

[0130] The beneficial effects achieved by the embodiments of the present invention are as follows:

[0131] 1. Provide a user scanning task management interface to visually manage user scanning tasks.

[0132] 2. This system can be used to quickly and easily scan all applications in the Kubernetes cluster to check for possible problems in the applications. The prior art only scans business applications and Kubernetes software itself, does not support services deployed in the Kubernetes cluster, and does not support scanning of Kubernetes components running on Kubernetes (these services and Kubernetes components are also applications). It also does not support user-defined scanning programs. The present invention can scan all applications including the cluster's own applications, so that anomalies including those of the cluster's own applications can be discovered.

[0133] 3. According to the scanning results, repair suggestions are provided for applications that may have problems, and the applications are optimized through the repair suggestions. In the prior art, there is no classification and summary of the scanned data, and no repair suggestions are given.

[0134] 4. Supports running user-defined programs in scanning tasks, with great scalability.

[0135] It should be understood that the specific order or hierarchy of steps in the disclosed process is an example of an exemplary method. Based on design preferences, it should be understood that the specific order or hierarchy of steps in the process can be rearranged without departing from the scope of protection of the present disclosure. The attached method claims present the elements of the various steps in an exemplary order and are not intended to be limited to the specific order or hierarchy described.

[0136] In the above detailed description, various features are grouped together in a single embodiment to simplify the disclosure. This method of disclosure should not be interpreted as reflecting an intention that the embodiments of the claimed subject matter require more features than are clearly stated in each claim. On the contrary, as reflected in the appended claims, the invention is in a state of having less than all the features of the disclosed individual embodiments. Therefore, the appended claims are hereby expressly incorporated into the detailed description, with each claim standing on its own as a separate preferred embodiment of the invention.

[0137] The disclosed embodiments are described above to enable any person skilled in the art to implement or use the present invention. Various modifications of these embodiments are obvious to those skilled in the art, and the general principles defined herein may also be applied to other embodiments without departing from the spirit and scope of the present disclosure. Therefore, the present disclosure is not limited to the embodiments given herein, but is consistent with the broadest scope of the principles and novel features disclosed in this application.

[0138] The above description includes examples of one or more embodiments. Of course, it is impossible to describe all possible combinations of components or methods for the purpose of describing the above embodiments, but it should be recognized by those skilled in the art that the various embodiments may be further combined and arranged. Therefore, the embodiments described herein are intended to cover all such changes, modifications and variations that fall within the scope of protection of the appended claims. In addition, with respect to the term "comprising" used in the specification or claims, the word is covered in a manner similar to the term "including", just as "including," is explained as a transitional word in the claims. In addition, any term "or" used in the specification of the claims is intended to mean "non-exclusive or".

[0139] Those skilled in the art may also understand that the various illustrative logical blocks, units, and steps listed in the embodiments of the present invention may be implemented by electronic hardware, computer software, or a combination of the two. In order to clearly demonstrate the interchangeability of hardware and software, the various illustrative components, units, and steps described above have generally described their functions. Whether such functions are implemented by hardware or software depends on the specific application and the design requirements of the entire system. Those skilled in the art may use various methods to implement the described functions for each specific application, but such implementation should not be understood as exceeding the scope of protection of the embodiments of the present invention.

[0140] The various illustrative logic blocks or units described in the embodiments of the present invention can be implemented or operated by a general-purpose processor, a digital signal processor, an application-specific integrated circuit (ASIC), a field programmable gate array or other programmable logic device, a discrete gate or transistor logic, a discrete hardware component, or any combination of the above. The general-purpose processor can be a microprocessor, and optionally, the general-purpose processor can also be any conventional processor, controller, microcontroller or state machine. The processor can also be implemented by a combination of computing devices, such as a digital signal processor and a microprocessor, a plurality of microprocessors, one or more microprocessors combined with a digital signal processor core, or any other similar configuration.

[0141] The steps of the method or algorithm described in the embodiments of the present invention can be directly embedded in hardware, a software module executed by a processor, or a combination of the two. The software module can be stored in a RAM memory, a flash memory, a ROM memory, an EPROM memory, an EEPROM memory, a register, a hard disk, a removable disk, a CD-ROM, or other storage media of any form in the art. Exemplarily, the storage medium can be connected to the processor so that the processor can read information from the storage medium and can write information to the storage medium. Optionally, the storage medium can also be integrated into the processor. The processor and the storage medium can be arranged in an ASIC, and the ASIC can be arranged in a user terminal. Optionally, the processor and the storage medium can also be arranged in different components in the user terminal.

[0142] In one or more exemplary designs, the above functions described in the embodiments of the present invention can be implemented in hardware, software, firmware or any combination of the three. If implemented in software, these functions can be stored on a computer-readable medium, or transmitted in the form of one or more instructions or codes on a computer-readable medium. Computer-readable media include computer storage media and communication media that facilitate the transfer of computer programs from one place to another. The storage medium can be any available medium that can be accessed by any general or special computer. For example, such computer-readable media can include but are not limited to RAM, ROM, EEPROM, CD-ROM or other optical disk storage, disk storage or other magnetic storage devices, or any other medium that can be used to carry or store program codes in the form of instructions or data structures and other forms that can be read by general or special computers, or general or special processors. In addition, any connection can be appropriately defined as a computer-readable medium, for example, if the software is transmitted from a website site, server or other remote resource through a coaxial cable, fiber optic cable, twisted pair, digital subscriber line (DSL) or wirelessly, such as infrared, wireless and microwave, it is also included in the defined computer-readable medium. The disk and disc include compact disk, laser disk, optical disk, DVD, floppy disk and blue-ray disk. Disks usually copy data magnetically, while discs usually copy data optically with lasers. The above combination can also be included in computer readable media.

[0143] The specific implementation methods described above further illustrate the objectives, technical solutions and beneficial effects of the present invention in detail. It should be understood that the above description is only a specific implementation method of the present invention and is not intended to limit the scope of protection of the present invention. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present invention should be included in the scope of protection of the present invention.

Claims

1. A method for performing abnormal scanning on an application of a kubernetes cluster, characterized in that: include: The scanning task manager obtains a scanning task for performing abnormal scanning on an application of a kubernetes cluster, and checks a scanning program set in the scanning task; the task type of the scanning task is a built-in task or a custom task; wherein the application of the kubernetes cluster includes at least one of the following: software for building the kubernetes cluster itself, a service deployed in the kubernetes cluster, a kubernetes component supporting the operation of a service, and a business application on the kubernetes cluster; When the scanning program passes the check, the scanning program is run by the task executor specified in the scanning task to scan the application of the specified kubernetes cluster; the scanning program is run by the task executor specified in the scanning task to scan the application of the specified kubernetes cluster, specifically including: If the task type in the scan task is a built-in task, the built-in task scanner corresponding to the built-in task is run, and the application of the specified kubernetes cluster is scanned by the built-in task scanner. After scanning the application of the specified kubernetes cluster, the scan result is obtained; If the task type in the scanning task is a custom task, the programming language used by the custom task scanner is analyzed; if the programming language used by the custom task scanner is a preset language, the running environment corresponding to the preset language is called to run the custom task scanner; the application of the specified kubernetes cluster is scanned by the custom task scanner, and the scanning result is obtained after scanning the application of the specified kubernetes cluster; If the programming language used by the custom task scanner is a non-preset language, the code of the custom task scanner is compiled into a code of a recognizable language, and the running environment that responds to the recognizable language is called to run the custom task scanner compiled into the recognizable language; the application of the specified kubernetes cluster is scanned by the scanner compiled into the recognizable language, and the scanning result is obtained after scanning the application of the specified kubernetes cluster; The scan result analyzer determines whether to generate modification suggestions based on the scan results.

2. The method for performing abnormal scanning on an application of a kubernetes cluster according to claim 1, characterized in that: The scanning task manager obtains a scanning task for performing abnormal scanning on the application of the kubernetes cluster, specifically including: The scanning task manager obtains a defined scanning task for performing abnormal scanning on an application of a kubernetes cluster from a user interaction interface, wherein the user interaction interface is used to generate a scanning task for performing abnormal scanning on an application of a kubernetes cluster, modify a scanning task for performing abnormal scanning on an application of a kubernetes cluster, delete a scanning task for performing abnormal scanning on an application of a kubernetes cluster, and / or query a scanning task for performing abnormal scanning on an application of a kubernetes cluster; The scanning task manager checks the scanning program set in the scanning task, specifically including: If the task type in the scan task is a built-in task, the scan task manager checks whether the data of the built-in task scanner corresponding to the built-in task conforms to the format; if the task type in the scan task is a custom task, the scan task manager checks whether the custom task scanner conforms to the preset format and conforms to the syntax specification of the programming language; If the scanner passes the check, the scanning task is saved; if the scanner fails the check, the reason for the failure is returned.

3. The method for performing abnormal scanning on an application of a kubernetes cluster according to claim 2, characterized in that: Also includes: Each task executor is registered with a storage component in the scanning task memory when it is generated, and declares its own label when registering. The task executor label includes: the identification of the task executor, the area where the task executor is located, the computer room where the task executor is located, and the number of hardware resources of the task executor itself; wherein the scanning task memory includes two storage components; If the scanning program passes the inspection, the scanning task is saved, which specifically includes: The scanning task memory obtains the scanning tasks that have passed the inspection, and adds all the scanning tasks that have passed the inspection to the two storage components in the scanning task memory; for the storage components, when the storage components are upgraded, the two storage components are upgraded in turn, and when one storage component is upgraded, the other storage component runs and has storage functions; and when the storage software entity connected to the storage component changes, the two storage components adapt to the interface or middleware of the changed storage software entity in turn; wherein the storage component contacts the storage software entity through the interface or middleware.

4. The method for performing abnormal scanning on an application of a kubernetes cluster according to claim 3, characterized in that: Also includes: The task acquirer obtains the scanning task from the running storage component at a regular interval, obtains the region where the task executor in the scanning task is located, allocates the task executor that matches the region to the scanning task, and adds the allocated task executor tag to the scanning task to form an updated scanning task; The updated scanning task is sent to the task distributor, and the task distributor obtains the task executor identification from the updated scanning task analysis. The task distributor determines whether the task executor in the scanning task has the ability to operate normally according to the monitoring situation of each task executor; When the task executor in the scan task has the ability to operate normally, the updated scan task is sent to the assigned task executor.

5. The method for performing abnormal scanning on an application of a kubernetes cluster according to claim 1, characterized in that: When there are at least two identical Kubernetes clusters, set the scan task to scan each identical Kubernetes cluster and set a separate task executor for each Kubernetes cluster. After scanning the application of the specified kubernetes cluster and obtaining the scanning result, it also includes: Send scan results to a data collector; The data collector formats the scan result into a json format; and sends the scan result in the json format to the scan result analyzer; wherein the scan results returned by multiple task executors of the same scan task are aggregated, and the aggregated scan results are formatted into a json format; The scanning result analyzer determines whether to generate a modification suggestion according to the scanning result, specifically including: When there are at least two identical Kubernetes clusters, the scan result analyzer analyzes the scan results in the JSON format. If all the scan results in the JSON format are consistent, the scan results are sent to the suggestion generator, which generates repair suggestions and saves them for display. If the scan results in the JSON format are inconsistent, the scan results are saved for display. When there are no at least two identical Kubernetes clusters, the scan result analyzer sends the scan results to the suggestion generator, which generates repair suggestions and saves them for display.

6. A system for performing abnormal scanning on applications in a kubernetes cluster, characterized in that: include: A scanning task manager is used to obtain a scanning task for performing abnormal scanning on an application of a kubernetes cluster, and check a scanning program set in the scanning task; the task type of the scanning task is a built-in task or a custom task; wherein the application of the kubernetes cluster includes at least one of the following: software for building the kubernetes cluster itself, services deployed on the kubernetes cluster, kubernetes components supporting service operation, and business applications on the kubernetes cluster; The task executor is specified in the scanning task and is used to run the scanning program to scan the application of the specified kubernetes cluster when the scanning program passes the check; the task executor is specifically used to: If the task type in the scan task is a built-in task, the built-in task scanner corresponding to the built-in task is run, and the application of the specified kubernetes cluster is scanned by the built-in task scanner. After scanning the application of the specified kubernetes cluster, the scan result is obtained; If the task type in the scanning task is a custom task, the programming language used by the custom task scanner is analyzed; if the programming language used by the custom task scanner is a preset language, the running environment corresponding to the preset language is called to run the custom task scanner; the application of the specified kubernetes cluster is scanned by the custom task scanner, and the scanning result is obtained after scanning the application of the specified kubernetes cluster; If the programming language used by the custom task scanner is a non-preset language, the code of the custom task scanner is compiled into a code of a recognizable language, and the running environment that responds to the recognizable language is called to run the custom task scanner compiled into the recognizable language; the application of the specified kubernetes cluster is scanned by the scanner compiled into the recognizable language, and the scanning result is obtained after scanning the application of the specified kubernetes cluster; The scan result analyzer is used to determine whether to generate modification suggestions based on the scan results.

7. The system for performing abnormal scanning on applications of a kubernetes cluster according to claim 6, characterized in that: The system also includes a user interaction interface, wherein: The scanning task manager is specifically used to obtain a scanning task defined to perform abnormal scanning on an application of a kubernetes cluster from a user interaction interface; The user interaction interface is used to generate a scanning task for performing anomaly scanning on an application of a kubernetes cluster, modify a scanning task for performing anomaly scanning on an application of a kubernetes cluster, delete a scanning task for performing anomaly scanning on an application of a kubernetes cluster, and / or query a scanning task for performing anomaly scanning on an application of a kubernetes cluster; The scanning task manager is specifically used to check whether the data of the built-in task scanning program corresponding to the built-in task conforms to the format if the task type in the scanning task is a built-in task; if the task type in the scanning task is a custom task, check whether the custom task scanning program conforms to the preset format and whether it conforms to the grammatical specifications of the programming language; if the scanning program passes the check, the scanning task is saved; if the scanning program fails the check, the reason for the check failure is returned.

8. The system for performing abnormal scanning on applications of a kubernetes cluster according to claim 7, characterized in that: The system further includes a scanning task memory, wherein the scanning task memory includes two storage components, and the task executor includes at least two, wherein: Each task executor is used to register with the storage component provided in the scanning task storage when it is generated, and declare its own label when registering, and the task executor label includes: the identification of the task executor, the area where the task executor is located, the computer room where the task executor is located, and the number of hardware resources of the task executor itself; The scanning task memory is used to obtain scanning tasks that have passed the inspection and add all the scanning tasks that have passed the inspection to two storage components in the scanning task memory; for the storage components, when the storage components are upgraded, the two storage components are upgraded in turn, and when one storage component is upgraded, the other storage component runs and has storage function; and when the storage software entity connected to the storage component changes, the two storage components adapt to the interface or middleware of the changed storage software entity in turn; wherein the storage component contacts the storage software entity through the interface or middleware.

9. The system for performing abnormal scanning on an application of a kubernetes cluster according to claim 8, characterized in that: It also includes a task acquirer and a task distributor, where: The task acquirer is used to acquire the scanning task from the storage component that runs automatically at a scheduled time, acquire the area where the task executor in the scanning task is located, allocate the task executor that matches the area to the scanning task, add the allocated task executor tag to the scanning task to form an updated scanning task, and send the updated scanning task to the task distributor; The task distributor is used to receive updated scanning tasks, analyze the updated scanning tasks to obtain task executor identification, and determine whether the task executors in the scanning tasks have the ability to operate normally based on the monitoring of each task executor; when the task executors in the scanning tasks have the ability to operate normally, the updated scanning tasks are sent to the assigned task executors.

10. The system for performing abnormal scanning on applications of a kubernetes cluster according to claim 6, characterized in that: When there are at least two identical Kubernetes clusters, set the scan task to scan each identical Kubernetes cluster and set a separate task executor for each Kubernetes cluster. The system for performing anomaly scanning on an application of a kubernetes cluster further includes a data collector and a suggestion generator, wherein: The data collector is used to obtain the scan result after scanning the application of the specified kubernetes cluster, receive the scan result; format the scan result into json format; send the scan result in json format to the scan result analyzer; wherein the scan results returned by multiple task executors of the same scan task are aggregated, and the aggregated scan results are formatted into json format; The scan result analyzer is specifically used to analyze each scan result in json format when there are at least two identical kubernetes clusters, and if all the scan results in the json format are consistent, the scan result is sent to the suggestion generator; if the scan results in the json format are inconsistent, the scan result is saved for display; when there are not at least two identical kubernetes clusters, the scan result is sent to the suggestion generator; The suggestion generator is used to generate repair suggestions according to the received scanning results and save them for display.

Citation Information

Patent Citations

  • Operation maintenance method and device for big data cluster

    CN109960690A

  • Health inspection method for k8s cluster, device thereof and equipment

    CN112448846A