Detection Method, Device, Equipment and Computer Readable Storage Medium
By deploying the first component in the container platform, obtaining declaration files and using working components to detect container application status in the Kubernetes cluster, the health status detection accuracy problem caused by the unreliable operation status of kubelets is solved, and the detection accuracy and efficiency are improved.
Patent Information
- Application Number
- CN202011074951.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-10-09
- Publication Date
- 2025-07-11
- Estimated Expiration
- 2040-10-09
AI Technical Summary
在Kubernetes集群中,kubelet的运行状态无法得到保证,导致应用的健康状态检测准确度降低。
By deploying a first component in the container platform, obtaining the declaration file of the second container group, determining the health detection strategy, and using the working components to detect applications in the container, improving the accuracy of health status detection.
It has achieved improvements in the accuracy and efficiency of health status detection for all container groups in the container platform.
Smart Images

Figure CN112131130B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of computer technologies. Specifically, this application relates to a detection method, apparatus, device, and computer-readable storage medium. Background Art
[0002] In the prior art, a component kubelet is started on each node Node in a container management Kubernetes cluster. One kubelet is responsible for detecting the health status of an application in a container of a basic scheduling unit Pod on a node, where a Pod is a container group. For example, if there are 10 nodes in a Kubernetes cluster, 10 kubelets are correspondingly required to be responsible for detecting the health status of the applications in the containers of the Pods on these 10 nodes, and these 10 kubelets respectively report the health statuses detected by themselves to a detection component ApiServer.
[0003] kubelet is started on a node in the form of a daemon process by a tool systemd. However, the running status of kubelet cannot be guaranteed. When kubelet fails or cannot work properly for other reasons, the Kubernetes cluster cannot know the actual running status of the application on the node where kubelet is located. For example, the application on node A is running normally, but the kubelet on node A fails, and kubelet cannot report the health status of the application on node A to ApiServer. Therefore, the Kubernetes cluster will mark the health status of the application on node A as unhealthy and reconstruct the application on node A on other nodes in the Kubernetes cluster, thereby reducing the detection accuracy of the health status of the application. Summary of the Invention
[0004] In view of the shortcomings of the existing method, this application provides a detection method, apparatus, electronic device, and computer-readable storage medium to solve the problem of how to improve the detection accuracy of the health status of an application.
[0005] In a first aspect, this application provides a detection method, which is applied to a first component of a first container group and includes:
[0006] Obtain a declaration file of at least one second container group;
[0007] Determine a health detection policy corresponding to an application in a container of at least one second container group according to the declaration file;
[0008] Determine at least one working component according to the health detection policy;
[0009] Detect the applications in the container through at least one working component, and determine the health status of the applications in the container.
[0010] In a second aspect, the present application provides a detection device, which is applied to a first component of a first container group, and includes:
[0011] A first processing module, configured to obtain the declaration files of at least one second container group;
[0012] A second processing module, configured to determine the health detection policies corresponding to the applications in the containers of at least one second container group according to the declaration files;
[0013] A third processing module, configured to determine at least one working component according to the health detection policies;
[0014] A fourth processing module, configured to detect the applications in the container through at least one working component, and determine the health status of the applications in the container.
[0015] In a third aspect, the present application provides an electronic device, including: a processor, a memory, and a bus;
[0016] The bus is used to connect the processor and the memory;
[0017] The memory is used to store operation instructions;
[0018] The processor is configured to execute the detection method of the first aspect of the present application by calling the operation instructions.
[0019] In a fourth aspect, the present application provides a computer-readable storage medium, storing a computer program, and the computer program is used to execute the detection method of the first aspect of the present application.
[0020] The technical solution provided by the embodiments of the present application has at least the following beneficial effects:
[0021] Obtain the declaration files of at least one second container group; determine the health detection policies corresponding to the applications in the containers of at least one second container group according to the declaration files; determine at least one working component according to the health detection policies; detect the applications in the container through at least one working component, and determine the health status of the applications in the container. In this way, a first component is deployed in the form of a first container group in the container platform, and the first component and the applications in the containers of at least one second container group are all in the container platform, realizing the detection of the health status of the applications in the containers of all second container groups in the container platform through one first component, improving the detection accuracy and detection efficiency of the health status of the applications. Description of the Drawings
[0022] To more clearly illustrate the technical solutions in the embodiments of the present application, the accompanying drawings required for the description of the embodiments of the present application will be briefly introduced below.
[0023] Figure 1 It is a schematic flowchart of a detection method provided by an embodiment of the present application;
[0024] Figure 2 It is a schematic diagram of the Kubernetes cluster architecture provided by an embodiment of the present application;
[0025] Figure 3 It is a schematic structural diagram of a detection device provided by an embodiment of the present application;
[0026] Figure 4 It is a schematic structural diagram of an electronic device provided by an embodiment of the present application. Detailed implementation manners
[0027] To make the objectives, features, and advantages of the present application more obvious and understandable, the technical solutions in the embodiments of the present application will be clearly and completely described below in conjunction with the accompanying drawings in the embodiments of the present application. Obviously, the described embodiments are only a part of the embodiments of the present application, rather than all the embodiments. Based on the embodiments of the present application, all other embodiments obtained by those skilled in the art without creative efforts belong to the scope of protection of the present application.
[0028] The embodiments of the present application will be described in detail below. The examples of the embodiments are shown in the accompanying drawings, where the same or similar reference numerals represent the same or similar elements or elements with the same or similar functions throughout. The embodiments described below by referring to the accompanying drawings are exemplary and are only used to explain the present application, and cannot be construed as a limitation of the present application.
[0029] Those skilled in the art of the present technology can understand that unless specifically stated otherwise, the singular forms "a", "an", "the", and "said" used herein may also include the plural forms. It should be further understood that the term "including" used in the specification of the present application means the presence of features, integers, steps, operations, elements, and / or components, but does not exclude the presence or addition of one or more other features, integers, steps, operations, elements, components, and / or their groups. It should be understood that when we say that an element is "connected" or "coupled" to another element, it can be directly connected or coupled to other elements, or there may also be intermediate elements. In addition, the "connection" or "coupling" used here may include wireless connection or wireless coupling. The phrase "and / or" used here includes all or any unit and all combinations of one or more related listed items.
[0030] Cloud computing is a computing model that distributes computing tasks across a resource pool composed of a large number of computing devices, enabling various application systems to obtain computing power, storage space, and information services as needed. The network that provides resources is called the "cloud". The resources in the "cloud" seem to users to be infinitely scalable, and can be obtained at any time, used on demand, expanded at any time, and paid according to usage.
[0031] As a basic capacity provider of cloud computing, a cloud computing resource pool (abbreviated as cloud platform, generally called IaaS (Infrastructure as a Service) platform) will be established, and various types of virtual resources will be deployed in the resource pool for external customers to choose and use. The cloud computing resource pool mainly includes: computing devices (virtual machines, including operating systems), storage devices, and network devices.
[0032] Logically divided, the PaaS (Platform as a Service) layer can be deployed on the IaaS (Infrastructure as a Service) layer, and the SaaS (Software as a Service) layer can be deployed on top of the PaaS layer. The SaaS layer can also be directly deployed on the IaaS. PaaS is a platform for software operation, such as databases, web containers, etc. SaaS is various business software, such as web portals, SMS mass senders, etc. Generally speaking, SaaS and PaaS are upper layers relative to IaaS.
[0033] To better understand and illustrate the solutions of the embodiments of the present application, some technical terms involved in the embodiments of the present application will be briefly described below.
[0034] Kubernetes: Used to manage containerized applications on multiple hosts in a cloud platform. The goal of Kubernetes is to make the deployment of containerized applications simple and efficient. Kubernetes provides a mechanism for application deployment, planning, updating, and maintenance. A series of building blocks are defined in the design structure of Kubernetes, aiming to provide a mechanism that can jointly provide the deployment, maintenance, and extension of application programs. The component design concepts that make up Kubernetes are loosely coupled and scalable, so that it can meet a variety of different workloads. Scalability is largely provided by the Kubernetes API, which is mainly used as an internal component for extension and the containers running on Kubernetes.
[0035] Pod: The basic scheduling unit of a Kubernetes cluster is called a pod. Through this kind of abstraction category, higher-level abstractions can be added to containerized components. A pod generally contains one or more containers, which can ensure that they are always on the host and can share resources. Each pod in a Kubernetes cluster is assigned a unique IP address, which allows applications to use the same port and avoids the problem of conflicts. A pod can define a volume, such as a local disk directory or a network disk, and expose it in one of the containers in the pod. Pods can be manually managed through the Kubernetes API or entrusted to a controller for automatic management.
[0036] Kubelet: Kubelet is responsible for the running status of each node, that is, ensuring that all containers on the node are running properly. Kubelet processes the startup, stop, and maintenance of application containers according to the instructions of the control panel. Kubelet will detect the status of the pod. If it is not in the desired state, the pod will be redeployed to the same node. The node status will send messages to the relay host every few seconds. After the master detects a node failure, the replication controller will observe this status change and start the pod on other healthy nodes.
[0037] Node: A node, also known as a Worker or Minion, is a single machine (or virtual machine) that deploys containers (workloads). Each node in the cluster must have a container runtime environment to communicate with the network configuration of the container.
[0038] ApiServer: The API server is a key component and provides the internal and external interfaces of Kubernetes using the Kubernetes API and JSON over HTTP. The API server processes and validates REST requests and updates the status of API objects in etcd, allowing clients to configure workloads and containers between Worker nodes.
[0039] Systemd: Systemd is a collection of system management daemons, tools, and libraries that can centrally manage and configure user processes. Users can start and stop user processes using simple command lines.
[0040] ExecAction: If the user specifies the ExecAction method, the execution command needs to be specified. The worker coroutine executes this command through the container and judges whether the exit code of this command is 0. If it is 0, the application in the container is considered healthy; otherwise, the application is unhealthy.
[0041] TCPSocketAction: If the user specifies the TCPSocketAction method, the port number accessible to the container needs to be specified. The working coroutine uses the container address and the specified port as a socket to perform a TCP check. If the port is open, the application inside the container is considered healthy; otherwise, the application is unhealthy.
[0042] HTTPGetAction: If the user specifies the HTTPGetAction method, the sub-path and port accessible to the container need to be specified. The working coroutine uses the container address, the specified port, and the sub-path as a URL (Uniform Resource Locator) to perform an HTTP (HyperText Transfer Protocol) request. If the response code is between 200 and 400, the application inside the container is considered healthy; otherwise, the application is unhealthy.
[0043] Process: A process is an execution activity of a program in a computer with respect to a certain data set. It is the basic unit for the system to allocate and schedule resources and is the basis of the operating system structure.
[0044] Thread: A thread is the smallest unit of a program execution flow. A standard thread consists of a thread identifier, the current instruction pointer, a set of registers, and a stack.
[0045] Coroutine: A coroutine is a program component. During execution, a coroutine can be interrupted to execute other tasks and then come back to continue the original operation; it can be understood as two or more programs working together.
[0046] The following uses specific embodiments to elaborate in detail on the technical solution of this application and how the technical solution of this application solves the above technical problems. These several specific embodiments can be combined with each other, and the same or similar concepts or processes may not be repeated in some embodiments. The embodiments of this application will be described below with reference to the accompanying drawings.
[0047] An embodiment of this application provides a detection method, which is applied to the first component of the first container group. The schematic flow diagram of this method is as Figure 1 shown, and this method includes:
[0048] S101, obtain the declaration files of at least one second container group.
[0049] Optionally, the first component of the first container group can obtain the declaration files of all second container groups at the same time. Each second container group has a declaration file; the declaration file is used to represent the way of deploying applications in the container platform.
[0050] Optionally, when a second container group includes only one container, the first component of the first container group may obtain a declaration file of the second container group, and the declaration file is the declaration file of the container. When a second container group includes multiple containers, the first component of the first container group may obtain the declaration file of each container in the multiple containers of the second container group, where each container in the multiple containers has a declaration file.
[0051] Optionally, the container platform includes a first container group and at least one second container group; the first container group includes a first container, the first container includes a first component, and the first container group is a basic scheduling unit Pod; the at least one second container group includes at least one second container, and an application is included in the at least one second container.
[0052] For example, the container platform is a container management Kubernetes cluster. As Figure 2 shown, the Kubernetes cluster includes a first container group and two second container groups. The first container group is container group c, and the two second container groups are container group a and container group b respectively. Container group c includes container 1. The container 1 included in container group c is the first container, and container 1 includes a first component, that is, a detection component. Container group a includes two second containers, which are container 1 and container 2 included in container group a respectively. An application exists in each of container 1 and container 2 included in container group a. Container group b includes a second container, which is container 3 included in container group b. An application exists in container 3 included in container group a.
[0053] Optionally, as Figure 2 shown, before obtaining the declaration files of the at least one second container group in step S101, it further includes:
[0054] Deploy a first component in the form of a Pod in the Kubernetes cluster, where the Pod is the first container group, that is, container group c; the first component is a detection component.
[0055] Optionally, no application exists in the first container included in the first container group. For example, as Figure 2 shown, container group c includes container 1. The container 1 included in container group c is the first container, container 1 includes a first component, that is, a detection component, and no application exists in container 1 included in container group c.
[0056] Optionally, the container platform includes only one first component, that is, only one first component is deployed in the container management Kubernetes cluster.
[0057] Optionally, before obtaining the declaration files of the at least one second container group in step S101, it further includes:
[0058] Detect the creation events of at least one second container group through a second component in a preset container platform, where the container platform includes at least one of a container management Kubernetes cluster and a serverless container platform, and the second component includes a detection component ApiServer;
[0059] When the creation events of at least one second container group are detected, trigger the first component to obtain the manifest files of at least one second container group.
[0060] Optionally, as Figure 2 shown, the probe component in container 1 included in container group c detects the creation events of container group a and container group b through the ApiServer in the preset Kubernetes cluster; when the probe component detects the creation events of container group a and container group b through the ApiServer, trigger the probe component to obtain the manifest file of container group a and the manifest file of container group b.
[0061] S102. Determine the health detection policies corresponding to the applications in the containers of at least one second container group according to the manifest files.
[0062] Optionally, the first component of the first container group determines the health detection policies corresponding to the applications in the containers of each second container group according to the manifest file of each second container group.
[0063] For example, as Figure 2 shown, the Kubernetes cluster includes a first container group and two second container groups. The first container group is container group c, and the two second container groups are container group a and container group b respectively. Container group c includes container 1. The container 1 included in container group c is the first container, and container 1 includes a first component, that is, a probe component. The probe component determines the health detection policies corresponding to the applications in container 1 and container 2 included in container group a respectively according to the manifest file of container group a. The probe component determines the health detection policy corresponding to the application in container 3 included in container group b according to the manifest file of container group b.
[0064] Optionally, determining the health detection policies corresponding to the applications in the containers of at least one second container group according to the manifest files includes:
[0065] Determine the health detection policies corresponding to each application in at least one second container according to the manifest files, where the health detection policies include at least one of container probe ExecAction, container probe TCPSocketAction, and container probe HTTPGetAction.
[0066] Optionally, determine at least one health detection policy corresponding to each application in a second container according to the manifest file.
[0067] For example, as Figure 2 shown, the applications in Container 1 included in Container Group a can simultaneously correspond to three different health check policies, which are ExecAction, TCPSocketAction, and HTTPGetAction respectively. The applications in Container 1 included in Container Group a can also simultaneously correspond to two different health check policies, and these two different health check policies can be any two of ExecAction, TCPSocketAction, and HTTPGetAction. The applications in Container 1 included in Container Group a can also correspond to only one health check policy, and this health check policy can be any one of ExecAction, TCPSocketAction, and HTTPGetAction. The applications in Container 2 included in Container Group a can simultaneously correspond to two different health check policies, which are TCPSocketAction and HTTPGetAction respectively. Each application in the second container can simultaneously correspond to multiple health check policies. In this way, the detection accuracy of the health status of each application in the second container can be improved.
[0068] Optionally, any one of ExecAction, TCPSocketAction, and HTTPGetAction is configured with the time for the first health check after starting the container, the time interval for each detection, the timeout time for waiting for a response after sending a health check request, etc. For example, the time for the first health check after starting the container in ExecAction is 5 seconds, the time interval for each detection is 3 seconds, and the timeout time for waiting for a response after sending a health detection request is 1 minute.
[0069] S103. Determine at least one working component according to the health check policy.
[0070] Optionally, the first component of the first container group determines one working component according to one health check policy.
[0071] Optionally, the working component includes at least one of a process, a thread, and a coroutine.
[0072] For example, as Figure 2As shown in the figure, the Kubernetes cluster includes a first container group and two second container groups. The first container group is container group c, and the two second container groups are container group a and container group b respectively. Container group c includes container 1. The container 1 included in container group c is the first container, and container 1 includes a first component, namely, a detection component. The detection component determines a working coroutine according to a health detection policy corresponding to the application in container 1 included in container group a. This working coroutine is working coroutine 1, and working coroutine 1 is a coroutine included in the working component. The detection component determines a working coroutine according to a health detection policy corresponding to the application in container 2 included in container group a. This working coroutine is working coroutine 2, and working coroutine 2 is a coroutine included in the working component. The detection component determines a working coroutine according to a health detection policy corresponding to the application in container 3 included in container group b. This working coroutine is working coroutine 3, and working coroutine 3 is a coroutine included in the working component.
[0073] Optionally, determining at least one working component according to the health detection policy includes:
[0074] According to N health detection policies corresponding to the same application in a second container, determine N working components corresponding to the N health detection policies respectively. The N working components are used to detect the same application simultaneously, and N is a positive integer.
[0075] For example, the first component of the first container group determines three working components corresponding to three health detection policies according to the three health detection policies corresponding to the same application in a second container. Among them, the three health detection policies are ExecAction, TCPSocketAction, and HTTPGetAction respectively, and the three working components are all coroutines included in the working component.
[0076] For example, the first component of the first container group determines working component A and working component B corresponding to ExecAction and TCPSocketAction respectively according to ExecAction and TCPSocketAction corresponding to the same application in a second container. Among them, working component A is a process and a coroutine, and working component B is a thread and a coroutine.
[0077] S104, detect the application in the container through at least one working component, and determine the health status of the application in the container.
[0078] Optionally, the first component of the first container group detects an application in a container through a working component, and determines the health status of the application.
[0079] Optionally, the first component of the first container group simultaneously detects the same application in one container through multiple working components to determine the health status of the application.
[0080] For example, as Figure 2 shown, the Kubernetes cluster includes a first container group and two second container groups. The first container group is container group c, and the two second container groups are container group a and container group b respectively. Container group c includes container 1. The container 1 included in container group c is the first container, and container 1 includes a first component, namely a detection component. The detection component detects an application in container 1 included in container group a through worker coroutine 1 to determine the health status of the application. The detection component detects an application in container 2 included in container group a through worker coroutine 2 to determine the health status of the application. The detection component detects an application in container 3 included in container group b through worker coroutine 3 to determine the health status of the application.
[0081] Optionally, detecting an application in a container through at least one working component to determine the health status of the application in the container includes:
[0082] Detecting an application in a container through M working components;
[0083] When the health status of an application is detected as unhealthy by any one of the M working components, determining the health status of the application as unhealthy;
[0084] When the health status of the application in the container is detected as healthy by all of the M working components, determining the health status of the application as healthy, where M is a positive integer.
[0085] Optionally, the first component of the first container group detects an application in a container through multiple worker coroutines; when the health status of the application is detected as unhealthy by any one of the multiple worker coroutines, determining the health status of the application as unhealthy; when the health status of the application is detected as healthy by all of the multiple worker coroutines, determining the health status of the application as healthy, where the worker coroutine is a coroutine included in the working component.
[0086] Optionally, after detecting an application in a container through at least one working component to determine the health status of the application in the container, it further includes:
[0087] When it is detected through at least one working component that the application in the container is in an end state, exiting at least one working component.
[0088] Optionally, when the detection component detects through a working coroutine that the application in the container has ended, that is, the container exits, the detection component will exit the working coroutine, and the working coroutine ends.
[0089] For example, as Figure 2 shown, when the detection component detects through working coroutine 1 that the application in container 1 included in container group a has ended, that is, container 1 included in container group a exits, the detection component will exit working coroutine 1, and working coroutine 1 ends. When the detection component detects through working coroutine 2 that the application in container 2 included in container group a has ended, that is, container 2 included in container group a exits, the detection component will exit working coroutine 2, and working coroutine 2 ends. When the detection component detects through working coroutine 1 and working coroutine 2 respectively that the applications in container 1 and container 2 included in container group a have ended, that is, both container 1 and container 2 exit, then container group a exits, and the detection component will exit working coroutine 1 and working coroutine 2, and both working coroutine 1 and working coroutine 2 end. When the detection component detects through working coroutine 3 that an application in container 3 included in container group b has ended, that is, container 3 exits, the detection component will exit working coroutine 3, and working coroutine 3 ends.
[0090] Optionally, when the detection component fails, the container management Kubernetes cluster will exit the container group including the detection component and generate a new container group, and the new container group includes a new detection component.
[0091] In the embodiment of the present application, obtain the declaration files of at least one second container group; determine the health detection policies corresponding to the applications in the containers of at least one second container group according to the declaration files; determine at least one working component according to the health detection policies; and detect the applications in the containers through at least one working component to determine the health status of the applications in the containers. In this way, a first component is deployed in the form of a first container group in the container platform, and the first component and the applications in the containers of at least one second container group are all in the container platform, realizing the detection of the health status of the applications in the containers of all second container groups in the container platform through one first component, improving the detection accuracy and detection efficiency of the health status of the applications.
[0092] To better understand the method provided by the embodiment of the present application, the solution of the embodiment of the present application will be further described below with reference to examples of specific application scenarios.
[0093] The method provided by the embodiments of this application is applied to Elastic Kubernetes Service (EKS). Elastic Kubernetes Service is a service mode launched by Tencent Cloud Container Service, which enables users to deploy workloads without purchasing nodes. In Elastic Kubernetes Service, the first component runs in the Kubernetes cluster in the form of a Pod, and the first component detects the health status of the applications in all containers within the Kubernetes cluster.
[0094] Optionally, as Figure 2 shown, a probe component is deployed in the Kubernetes cluster in the form of a pod, that is, the first component. The probe component runs in container 1 included in container group c in the form of a Pod, and detects the creation event of the second container group through the ApiServer in the Kubernetes cluster. When the probe component detects the creation events of container group a and container group b through the ApiServer, it triggers the probe component to obtain the manifest files of container group a and container group b.
[0095] The probe component obtains the manifest file of container group a. The probe component determines the health detection policies corresponding to the applications in container 1 and container 2 included in container group a according to the manifest file of container group a. The probe component determines a worker coroutine according to a health detection policy corresponding to the application in container 1 included in container group a. This worker coroutine is worker coroutine 1, and worker coroutine 1 is a coroutine included in the worker component. The probe component determines a worker coroutine according to a health detection policy corresponding to the application in container 2 included in container group a. This worker coroutine is worker coroutine 2, and worker coroutine 2 is a coroutine included in the worker component. The probe component initiates access to the application in container 1 included in container group a at regular intervals according to the preset detection time through worker coroutine 1, and detects the health status of the application in container 1 included in container group a. The probe component initiates access to the application in container 2 included in container group a at regular intervals according to the preset detection time through worker coroutine 2, and detects the health status of the application in container 2 included in container group a.
[0096] The probe component obtains the manifest file of container group b. The probe component determines the health detection policy corresponding to the application in container 3 included in container group b according to the manifest file of container group b. The probe component determines a worker coroutine according to a health detection policy corresponding to the application in container 3 included in container group b. This worker coroutine is worker coroutine 3, and worker coroutine 3 is a coroutine included in the worker component. The probe component initiates access to the application in container 3 included in container group b at regular intervals according to the preset detection time through worker coroutine 3, and detects the health status of the application in container 3 included in container group b.
[0097] When the detection component detects through working coroutine 1 that the application in container 1 included in container group a ends, that is, container 1 included in container group a exits, the detection component will exit working coroutine 1 and working coroutine 1 ends. When the detection component detects through working coroutine 2 that the application in container 2 included in container group a ends, that is, container 2 included in container group a exits, the detection component will exit working coroutine 2 and working coroutine 2 ends. When the detection component detects through working coroutine 3 that an application in container 3 included in container group b ends, that is, container 3 exits, the detection component will exit working coroutine 3 and working coroutine 3 ends.
[0098] In an embodiment of the present application, a first component runs in the Kubernetes cluster in the form of a Pod. Kubernetes manages the life cycle of the first component, ensuring the normal operation of the first component. The first component is network-interconnected with the applications in all containers within the Kubernetes cluster. Therefore, a first component can detect the health status of the applications in all containers within the Kubernetes cluster, thereby improving the detection accuracy and detection efficiency of the health status of the applications.
[0099] Based on the same inventive concept, an embodiment of the present application further provides a detection device, which is applied to the first component of the first container group. The structural schematic diagram of the device is as Figure 3 shown. The detection device 30 includes a first processing module 301, a second processing module 302, a third processing module 303, and a fourth processing module 304.
[0100] The first processing module 301 is configured to obtain the manifest files of at least one second container group;
[0101] The second processing module 302 is configured to determine the health detection policies corresponding to the applications in the containers of at least one second container group according to the manifest files;
[0102] The third processing module 303 is configured to determine at least one working component according to the health detection policies;
[0103] The fourth processing module 304 is configured to detect the applications in the containers through at least one working component to determine the health status of the applications in the containers.
[0104] Optionally, the first processing module 301 is further configured to detect the creation events of at least one second container group through a second component in a preset container platform. The container platform includes at least one of a container management Kubernetes cluster and a serverless container platform. The second component includes a detection component ApiServer. When detecting the creation events of at least one second container group, it triggers the first component to obtain the manifest files of at least one second container group, and the manifest files are used to characterize the way of deploying applications in the container platform.
[0105] Optionally, the container platform includes a first container group and at least one second container group; the first container group includes a first container, the first container includes a first component, and the first container group is a basic scheduling unit Pod; the at least one second container group includes at least one second container, and an application is included in the at least one second container.
[0106] Optionally, the second processing module 302 is specifically configured to determine, according to the declaration file, a health detection policy corresponding to each application in at least one second container, and the health detection policy includes at least one of a container probe ExecAction, a container probe TCPSocketAction, and a container probe HTTPGetAction.
[0107] Optionally, the third processing module 303 is specifically configured to determine, according to N health detection policies corresponding to the same application in one second container, N working components respectively corresponding to the N health detection policies, and the N working components are used to simultaneously detect the same application, where N is a positive integer.
[0108] Optionally, the fourth processing module 304 is specifically configured to detect an application in a container through M working components; when the health status of an application is detected as unhealthy by any one of the M working components, determine that the health status of the application is unhealthy; when the health status of the application in the container is detected as healthy by all of the M working components, determine that the health status of the application is healthy, where M is a positive integer.
[0109] Optionally, the working component includes at least one of a process, a thread, and a coroutine.
[0110] Applying the embodiments of the present application has at least the following beneficial effects:
[0111] Obtain a declaration file of at least one second container group; determine, according to the declaration file, a health detection policy corresponding to an application in a container of the at least one second container group; determine at least one working component according to the health detection policy; detect the application in the container through the at least one working component, and determine the health status of the application in the container. In this way, a first component is deployed in the form of a first container group in the container platform, and the first component and the applications in the containers of the at least one second container group are all in the container platform, realizing the detection of the health status of the applications in the containers of all second container groups in the container platform through one first component, improving the detection accuracy and detection efficiency of the health status of the applications.
[0112] Based on the same inventive concept, the embodiments of the present application further provide an electronic device, and a schematic structural diagram of the electronic device is as Figure 4As shown, the electronic device 9000 includes at least one processor 9001, a memory 9002, and a bus 9003. At least one processor 9001 is electrically connected to the memory 9002. The memory 9002 is configured to store at least one computer-executable instruction, and the processor 9001 is configured to execute the at least one computer-executable instruction, thereby performing the steps of any one of the detection methods provided in any embodiment or any alternative embodiment of the present application.
[0113] Further, the processor 9001 may be an FPGA (Field-Programmable Gate Array), or other devices with logical processing capabilities, such as an MCU (Microcontroller Unit) or a CPU (Central Processing Unit).
[0114] Applying the embodiments of the present application has at least the following beneficial effects:
[0115] Obtain the declaration files of at least one second container group; determine the health detection policies corresponding to the applications in the containers of the at least one second container group according to the declaration files; determine at least one working component according to the health detection policies; detect the applications in the containers through the at least one working component to determine the health status of the applications in the containers. In this way, a first component is deployed in the form of a first container group in the container platform. The first component and the applications in the containers of at least one second container group are all in the container platform, realizing the detection of the health status of the applications in the containers of all second container groups in the container platform through a first component, improving the detection accuracy and detection efficiency of the health status of the applications.
[0116] Based on the same inventive concept, the embodiments of the present application also provide another computer-readable storage medium storing a computer program, which is used to implement the steps of any one of the detections provided in any embodiment or any alternative embodiment of the present application when executed by a processor.
[0117] The computer-readable storage media provided by the embodiments of the present application include, but are not limited to, any type of disk (including floppy disks, hard disks, optical disks, CD-ROMs, and magneto-optical disks), ROM (Read-Only Memory), RAM (Random Access Memory), EPROM (Erasable Programmable Read-Only Memory), EEPROM (Electrically Erasable Programmable Read-Only Memory), flash memory, magnetic cards, or optical cards. That is, the readable storage media include any medium that stores or transmits information in a form readable by a device (e.g., a computer).
[0118] Applying the embodiments of the present application has at least the following beneficial effects:
[0119] Obtain the declaration files of at least one second container group; determine the health detection policies corresponding to the applications in the containers of at least one second container group according to the declaration files; determine at least one working component according to the health detection policies; and detect the applications in the containers through at least one working component to determine the health status of the applications in the containers. In this way, a first component is deployed in the form of a first container group in the container platform. The first component and the applications in the containers of at least one second container group are all in the container platform, realizing the detection of the health status of the applications in the containers of all second container groups in the container platform by one first component, improving the detection accuracy and detection efficiency of the health status of the applications.
[0120] Those skilled in the art of the present technology can understand that each block in these structure diagrams and / or block diagrams and / or flowcharts, as well as the combinations of the blocks in these structure diagrams and / or block diagrams and / or flowcharts, can be implemented by computer program instructions. Those skilled in the art of the present technology can understand that these computer program instructions can be provided to a processor of a general-purpose computer, a professional computer, or other programmable data processing methods to implement, so that the processor of the computer or other programmable data processing methods executes the solutions specified in one or more blocks of the structure diagrams and / or block diagrams and / or flowcharts disclosed in the present application.
[0121] Those skilled in the art can understand that the various operations, methods, steps, measures, and solutions in the processes discussed in this application can be alternated, changed, combined, or deleted. Further, other steps, measures, and solutions in the various operations, methods, and processes discussed in this application can also be alternated, changed, rearranged, decomposed, combined, or deleted. Further, those in the prior art that have steps, measures, and solutions in the various operations, methods, and processes disclosed in this application can also be alternated, changed, rearranged, decomposed, combined, or deleted.
[0122] The above are only some implementation manners of this application. It should be noted that for those of ordinary skill in the art, without departing from the principle of this application, several improvements and refinements can be made, and these improvements and refinements should also be regarded as the protection scope of this application.
Claims
1. A detection method, applied to a first component of a first container group, characterized in that Including: Detecting, by a second component in a preset container platform, a creation event of at least one second container group, where the container platform includes at least one of a container management Kubernetes cluster and a serverless container platform, and the second component includes a detection component ApiServer; When detecting the creation event of the at least one second container group, triggering the first component to obtain a declaration file of the at least one second container group, where the declaration file is used to characterize the way of deploying an application in the container platform; Obtaining the declaration file of the at least one second container group, and each container in each second container group has a declaration file; Determining, according to the declaration file, a health detection policy corresponding to an application in the container of the at least one second container group; Determining at least one working component according to the health detection policy; Detecting, by the at least one working component, the application in the container to determine the health status of the application in the container.
2. The method according to claim 1, wherein The container platform includes the first container group and the at least one second container group; the first container group includes a first container, the first container includes the first component, and the first container group is a basic scheduling unit Pod; the at least one second container group includes at least one second container, and the at least one second container includes an application.
3. The method according to claim 2, wherein The determining, according to the declaration file, a health detection policy corresponding to an application in the container of the at least one second container group includes: Determining, according to the declaration file, a health detection policy corresponding to each application in the at least one second container, where the health detection policy includes at least one of a container probe ExecAction, a container probe TCPSocketAction, and a container probe HTTPGetAction.
4. The method according to claim 2, wherein The determining at least one working component according to the health detection policy includes: Determining, according to N health detection policies corresponding to the same application in a second container, N working components respectively corresponding to the N health detection policies, where the N working components are used to detect the same application simultaneously, and N is a positive integer.
5. The method according to claim 1, wherein The detecting, by the at least one working component, the application in the container to determine the health status of the application in the container includes: Detecting, by M working components, an application in the container; When it is detected by any one of the M working components that the health status of the application is unhealthy, determining that the health status of the application is unhealthy; When it is detected by all of the M working components that the health status of the application in the container is healthy, determining that the health status of the application is healthy, and M is a positive integer.
6. The method according to claim 1, characterized in that, The working component includes at least one of a process, a thread, and a coroutine.
7. A detection device is applied to a first component of a first container group, characterized in that, Including: The first processing module is used to detect the creation event of at least one second container group through a second component in a preset container platform, where the container platform includes at least one of a container management Kubernetes cluster and a serverless container platform, and the second component includes a detection component ApiServer; when the creation event of the at least one second container group is detected, trigger the first component to obtain a declaration file of the at least one second container group, and the declaration file is used to characterize the way of deploying an application in the container platform. Obtain the declaration file of the at least one second container group, and each container in each second container group has a declaration file. The second processing module is used to determine a health detection strategy corresponding to the application in the container of the at least one second container group according to the declaration file. The third processing module is used to determine at least one working component according to the health detection strategy. The fourth processing module is used to detect the application in the container through the at least one working component and determine the health status of the application in the container.
8. The device according to claim 7, characterized in that The container platform includes the first container group and the at least one second container group; the first container group includes a first container, the first container includes the first component, and the first container group is a basic scheduling unit Pod; the at least one second container group includes at least one second container, and an application is included in the at least one second container.
9. The device according to claim 8, wherein The second processing module is specifically used for: Determine a health detection strategy corresponding to each application in the at least one second container according to the declaration file, and the health detection strategy includes at least one of a container probe ExecAction, a container probe TCPSocketAction, and a container probe HTTPGetAction.
10. The device according to claim 8, characterized in that, The third processing module is specifically used for: According to N health detection strategies corresponding to the same application in a second container, determine N working components respectively corresponding to the N health detection strategies, and the N working components are used to detect the same application simultaneously, where N is a positive integer.
11. The device according to claim 7, characterized in that, The fourth processing module is specifically used for: Detect an application in the container through M working components; When it is detected by any one of the M working components that the health status of the application is unhealthy, determine that the health status of the application is unhealthy; When it is detected by all of the M working components that the health status of the application in the container is healthy, determine that the health status of the application is healthy, where M is a positive integer.
12. The device according to claim 7, characterized in that, The working component includes at least one of a process, a thread, and a coroutine.
13. An electronic device, characterized in that, Includes: A processor and a memory; The memory is used to store a computer program; The processor is used to execute the detection method according to any one of claims 1-6 by calling the computer program.
14. A computer-readable storage medium, characterized in that, A computer program is stored, and the computer program is used to implement the detection method according to any one of claims 1-6 when being executed by a processor.
Citation Information
Patent Citations
Cloud data center Kubernetes cluster container health examination method and device
CN108737215A
Monitoring method, monitoring system and computer readable storage medium
CN109697153A