Mirror image processing method and device, equipment and storage medium

The image layer file is parsed and synchronized in the Kubernetes cluster through the image manager and task manager, which solves the problem of low image sharing efficiency and achieves rapid image synchronization and container creation.

CN118689593AInactive Publication Date: 2024-09-24CAPITALONLINE DATA SERVICE CO LTD

Patent Information

Application Number
CN202410851307.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-06-27
Publication Date
2024-09-24
Estimated Expiration
Not applicable · inactive patent

AI Technical Summary

Technical Problem

The image sharing solution in the Kubernetes architecture is inefficient, especially in large-volume image scenarios. When the target image does not exist on the node, the image needs to be pulled from the outside, resulting in a long time to create the container.

Method used

Parse the target image layer file in the cluster through the image manager, generate an image cache task, and synchronize the image layer file to other nodes through the task manager to achieve image synchronization within the cluster, reduce dependence on the external network, and improve the image synchronization speed .

Benefits of technology

Mirror synchronization within the cluster avoids the impact of the external network, significantly improves the speed of mirror synchronization, and thereby reduces the time required to create containers.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118689593A
    Figure CN118689593A
Patent Text Reader

Abstract

The invention provides a mirror image processing method and device, equipment and a storage medium. The method comprises the steps of analyzing a mirror image layer file of a target mirror image under the condition that the target mirror image exists on a first node of a cluster through a mirror image manager, and generating a mirror image cache task; and sending the mirror image cache task to a task manager of a second node through the mirror image manager so as to synchronize a mirror image layer file of the target mirror image to the second node through the task manager. According to the scheme, if the target mirror image exists on the first node in the cluster, the target mirror image can be synchronized to other second nodes in the cluster, and due to the fact that mirror image synchronization is carried out between the nodes in the cluster, the mirror image synchronization is not affected by an external network, and the mirror image synchronization speed is high.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present disclosure relates to the field of computer technology, and in particular to the field of cluster technology, image management technology, and container control technology. Background Art

[0002] Currently, container technology is popular because of its lightweight, easy to create and distribute features. Using container technology can greatly save manpower and material resources. However, once containers are scaled up, container lifecycle management becomes very complicated. Container orchestration tools such as Kubernetes (can be referred to as k8s or "kube") can manage container lifecycles, simplify container orchestration, and easily achieve container elasticity and high availability. However, the image sharing solution in the Kubernetes architecture is inefficient. Summary of the invention

[0003] The present disclosure provides an image processing method, apparatus, device and storage medium to solve or alleviate one or more technical problems in the prior art.

[0004] In a first aspect, the present disclosure provides a mirror processing method, comprising:

[0005] When the image manager detects that the target image exists on the first node of the cluster, the image layer file of the target image is parsed, and an image cache task is generated;

[0006] The image cache task is sent to the task manager of the second node through the image manager, so that the image layer file of the target image is synchronized to the second node through the task manager.

[0007] In a second aspect, the present disclosure provides an image processing device, comprising:

[0008] A first parsing module is used to parse the image layer file of the target image and generate an image cache task when the image manager detects that the target image exists on the first node of the cluster;

[0009] The synchronization module is used to send the image cache task to the task manager of the second node through the image manager, so as to synchronize the image layer file of the target image to the second node through the task manager.

[0010] In a third aspect, an electronic device is provided, including:

[0011] at least one processor; and

[0012] a memory communicatively connected to the at least one processor; wherein,

[0013] The memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to execute any method in the embodiments of the present disclosure.

[0014] In a fourth aspect, a non-transitory computer-readable storage medium storing computer instructions is provided, wherein the computer instructions are used to cause the computer to execute any method according to the embodiments of the present disclosure.

[0015] In a fifth aspect, a computer program product is provided, comprising a computer program, which implements any method according to the embodiments of the present disclosure when executed by a processor.

[0016] The beneficial effects of the technical solution provided by the present disclosure include at least: if a target image exists on a first node within a cluster, the target image can be synchronized to other second nodes within the cluster. Since the image synchronization is performed between nodes within the cluster, it is not affected by the external network and the image synchronization speed is fast.

[0017] It should be understood that the content described in this section is not intended to identify the key or important features of the embodiments of the present disclosure, nor is it intended to limit the scope of the present disclosure. Other features of the present disclosure will become easily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS

[0018] In the accompanying drawings, unless otherwise specified, the same reference numerals throughout the multiple drawings represent the same or similar parts or elements. These drawings are not necessarily drawn to scale. It should be understood that these drawings only depict some embodiments provided according to the present disclosure and should not be regarded as limiting the scope of the present disclosure.

[0019] Figure 1 is a flowchart of a mirror processing method according to an embodiment of the present disclosure;

[0020] Figure 2 is a flowchart of a mirror processing method according to another embodiment of the present disclosure;

[0021] Figure 3 is a flowchart of a mirror processing method according to another embodiment of the present disclosure;

[0022] Figure 4 is a flowchart of a mirror processing method according to another embodiment of the present disclosure;

[0023] Figure 5 is a flowchart of a mirror processing method according to another embodiment of the present disclosure;

[0024] Figure 6 This is a flowchart of the container image caching method between Kubernetes nodes;

[0025] Figure 7 is a structural schematic diagram of an image processing device according to an embodiment of the present disclosure;

[0026] Figure 8 is a structural schematic diagram of an image processing device according to another embodiment of the present disclosure;

[0027] Fig. 9 is a block diagram of an electronic device for implementing an embodiment of the present disclosure. DETAILED DESCRIPTION

[0028] The present disclosure will be further described in detail below with reference to the accompanying drawings. The same reference numerals in the accompanying drawings represent elements with the same or similar functions. Although various aspects of the embodiments are shown in the accompanying drawings, the drawings are not necessarily drawn to scale unless otherwise specified.

[0029] In addition, in order to better illustrate the present disclosure, numerous specific details are given in the following specific embodiments. It should be understood by those skilled in the art that the present disclosure can also be implemented without certain specific details. In some examples, methods, means, components and circuits well known to those skilled in the art are not described in detail in order to highlight the main purpose of the present disclosure.

[0030] Examples of image sharing solutions in the Kubernetes architecture are as follows: (1) Image acquisition is achieved by using a public image repository such as Dockerhub or building a private image repository such as Harbor. The node pulls the image from the image repository. When it is first created, the image pulling time may be relatively long and is easily restricted by the network environment. (2) Image distribution between nodes is achieved based on the p2p principle. This solution requires that the image already exists on the nodes in the cluster and will only pull the image when it is needed.

[0031] In the scenario of large-volume images, if the target image does not exist on the node and needs to be pulled on-site, it will take a long time to create the container.

[0032] Figure 1 FIG. 1 is a flow chart of a mirror processing method according to an embodiment of the present disclosure. In one implementation, the method may include:

[0033] S101, when the image manager detects that a target image exists on the first node of the cluster, parsing the image layer file of the target image and generating an image cache task;

[0034] S102: Send the image cache task to the task manager of the second node through the image manager, so as to synchronize the image layer file of the target image to the second node through the task manager.

[0035] In some examples, the cluster can be a Kubernetes cluster. Kubernetes is an open source container orchestration platform that can automatically manage and scale containerized applications. For example, a Kubernetes cluster can include a group of hosts running Linux containers. A Kubernetes cluster can be visualized as two parts: a control plane and computing devices (or nodes). Each node can include its own operating environment, which can include physical machines and / or virtual machines. Each node can run a container set consisting of several containers. A Kubernetes cluster can include multiple nodes, and the types of nodes in the cluster can include master nodes and worker nodes, etc.

[0036] In the disclosed embodiment, a mirror manager and a task manager may be set in the cluster. The mirror manager may manage the mirrors of all nodes in the cluster, and the task manager may manage the tasks on the node where it is located. For example, one or more mirror managers may be deployed in the cluster, and a task manager may be deployed on each node of the cluster. The mirror manager may first obtain basic information of the target image, such as the name and version of the target image, according to the cache strategy. Then, according to the basic information of the target image, the basic information of the images cached on all nodes in the cluster is traversed, for example, the basic information of the images cached on the nodes stored in the database is traversed to find the node including the basic information of the target image, i.e., the first node. The cache strategy may include the basic information of one or more target images, and the number of the first node may also be one or more. For example, the cache strategy includes target images M1, M2, and M3. The mirror manager traverses the cluster to find that node A has target image M1, and node B has target images M2 and M3. Node A and node B are the first nodes.

[0037] In the embodiment of the present disclosure, the image manager searches for the existence of the target image on one or more first nodes according to the basic information such as the name and version of the target image. For example, according to the basic information such as the name and version of the target image in the first node, the index corresponding to the target image, such as the image ID, can be parsed, and then the image layer file of the target image can be obtained according to the index corresponding to the target image. The image layer file may include a description file of the image layer structure. Then, it is also possible to check whether the image layer file of the target image is normal through some inspection rules, such as checking whether the image layer file is complete, whether it has been tampered with, or whether it is available. If the inspection result is that the image layer file of the target image is normal, an image cache task can be generated according to the basic information and / or index of the target image. The image cache task may include one or more of the information of the node that needs to synchronize the target image, the information of the node where the target image is located, the basic information of the target image, and the index of the target image. If there is a target image on the first node, the image manager can send an image cache task to other nodes other than the first node, that is, the second node, to synchronize the target image. The image manager can synchronize the image layer file of the target image to all nodes in the cluster through the image cache task.

[0038] In the disclosed embodiment, after receiving the image cache task, the task manager on the second node can parse the image cache task, obtain the information of the first node storing the target image, pull the image layer file of the target image from the first node according to the basic information and / or index of the target image, and cache the image layer file of the target image in the node. After the image synchronization is completed, a container related to the target image can be created on the node with the target image.

[0039] According to an embodiment of the present disclosure, if a target image exists on a first node within a cluster, the target image can be synchronized to other second nodes within the cluster. Since the image synchronization is performed between nodes within the cluster, it is not affected by the external network and the image synchronization speed is fast. For example, when the image processing method of the embodiment of the present application is used in a container orchestration tool such as k8s, when the target image does not exist on a node within the cluster, the image can be synchronized from other internal nodes first, reducing the time required to pull the image from the outside, thereby reducing the time consumed in creating containers.

[0040] Figure 2 : is a flow chart of a mirror processing method according to another embodiment of the present disclosure. The method may include one or more features of the above-mentioned mirror processing method. In one embodiment, the method further includes:

[0041] S201. When the target image does not exist in all nodes of the cluster, the image manager sends a task for pulling the target image to a third node of the cluster, so that the task manager of the third node pulls the target image for the third node from outside the cluster;

[0042] S202: When the target image is successfully pulled, the image layer file of the target image is parsed by the image manager.

[0043] In the disclosed embodiment, the image manager searches each node in the entire cluster according to the basic information of the target image in the image cache strategy. If the target image does not exist on all nodes of the entire cluster, for example, all nodes do not have the basic information such as the name and version of the target image, then the target image needs to be pulled from the outside. The image manager can issue a pull task for the target image to the third node of the cluster. The pull task may include the name, version and other basic information of the target image to be pulled. The third node may be the same as the first node or the second node, or different from the first node or the second node. The third node may have the function of pulling the target image from an external network or an external storage medium. After receiving the pull task for the target image, the task manager of the third node can parse the pull task for the target image, obtain the basic information such as the name and version of the target image to be pulled, and pull the image layer file (file content) of the target image from the external network or the external storage medium according to the basic information of the target image.

[0044] In the disclosed embodiment, after the third node pulls the target image from the outside, the image manager can parse the target image on the third node, obtain the image layer file of the target image, and generate an image cache task. The image cache task can include basic information such as the name and version number of the target image, and can also include information such as the index of the target image. The image manager of the master node can publish the image cache task to the task managers of other nodes except the third node, and the task manager of the node that receives the image cache task can perform the image cache operation and synchronize the image layer file of the target image to the local cache.

[0045] According to an embodiment of the present disclosure, when the target image does not exist in the cluster, the target image is obtained from the outside and distributed in the cluster, which can meet more target image synchronization requirements and improve the image synchronization speed. In turn, the container generation speed is improved.

[0046] Figure 3 : is a flow chart of a mirror processing method according to another embodiment of the present disclosure. The method may include one or more features of the above-mentioned mirror processing method. In one embodiment, the method further includes:

[0047] S301 , determining, by the image manager, whether the target image exists on the node of the cluster according to the basic information of the target image in the image cache policy and the node cache status in the database of the cluster.

[0048] In the disclosed embodiment, the database of the cluster may store the node cache status of each node, such as at least one of the basic information such as the image name and version cached in the node. The image manager may search in the database according to the basic information of the target image to be cached in the image cache strategy to obtain the information of the node where the target image is located.

[0049] According to the embodiment of the present disclosure, the node cache status of the entire cluster can be traversed through the image manager, so as to quickly locate the node where the target image is located, thereby improving the synchronization speed of the target image.

[0050] Figure 4 : is a flow chart of a mirror processing method according to another embodiment of the present disclosure. The method may include one or more features of the above-mentioned mirror processing method. In one embodiment, the method further includes:

[0051] S401. Register cache-related Custom Resource Definitions (CRD) in the cluster through a deployment file to deploy an image cache strategy in the cluster.

[0052] In one embodiment, the image cache strategy includes at least one of the following:

[0053] The name and version of the target image;

[0054] The time to execute the image cache task;

[0055] The target image pulling method includes one of the following: re-pulling the target image each time; pulling the target image when the target image does not exist on all nodes in the cluster.

[0056] In the disclosed embodiment, the CRD may be deployed in a cluster through a deployment file, and the CRD may include an image cache strategy.

[0057] In the disclosed embodiment, the image manager can obtain the name and version of the target image, the time to execute the image cache task, and the target image pulling method according to the image cache strategy deployed by the CRD. The image manager can generate an image cache task based on the above information. If the target image pulling method is to re-pull the target image each time, a pull task for the target image can be sent to a specified node in the cluster, and the image cache task can be generated after the target image is pulled from the outside. If the target image pulling method is to pull the target image when the target image does not exist on all nodes in the cluster, after parsing the name and version of the target image, it can first traverse all nodes in the cluster to see if the target image exists. If it exists, an image cache task can be generated directly.

[0058] In one implementation, the image cache task includes at least one of the following:

[0059] The node where the target image is located;

[0060] The name of the target image;

[0061] The version of the target image;

[0062] The node that needs to synchronize the target image;

[0063] Information about the associated cache policy.

[0064] In the disclosed embodiment, after receiving the image cache task, the task manager can check whether the information of the associated cache policy is valid. For example, if the image cache task is generated according to the image cache policy P1, and the image cache policy P1 is valid, the task manager can continue to execute the image cache task according to other information. If the image cache policy P1 is invalid, the task manager may not execute the image cache task. The status of whether the image cache policy is valid can be saved in the database. In an image cache task, the node where the target image is located can be one or more nodes. For example, the node where the target image is located is node B, and the node that needs to synchronize the target image is node C. Node C can synchronize the image layer of the target image from node B. For another example, the nodes where the target image is located are nodes A and B, and the node that needs to synchronize the target image is node C. Node C can synchronize the image layer of the target image from either node A or node B.

[0065] According to an embodiment of the present disclosure, a cache strategy can be automatically configured according to the CRD to improve the efficiency of mirror synchronization in the cluster.

[0066] Figure 5It is a flowchart of an image processing method according to another embodiment of the present disclosure. The method may include one or more features of the above-mentioned image processing method. In one embodiment, the image manager is used to manage the images of one or more nodes on the cluster, and the task manager is used to run a container on each node to perform the image cache task. The master node of the cluster includes the image manager, and the master node and the working node of the cluster include the task manager.

[0067] In the disclosed embodiment, a cluster may generally include a master node and several working nodes. A task manager may be deployed on all nodes in the cluster, and an image manager may be deployed on some nodes.

[0068] In one embodiment, the cluster includes a plurality of image managers, and the method further includes:

[0069] S501: When the main image manager of the cluster is abnormal, other image managers re-elect the main image manager.

[0070] In the disclosed embodiment, multiple image managers can be deployed on the master node in the cluster. The master image manager may be abnormal and fail to work properly. In this case, other image managers on the master node will detect the abnormality of the master image manager, and other image managers can vote to elect a master image manager, and the elected new master image manager can take over the functions of the original master image manager.

[0071] According to an embodiment of the present disclosure, when the main image manager is abnormal, a new main image manager can be elected in time, so that image cache tasks can be generated normally, thereby improving the availability of the image manager.

[0072] The image processing method of the embodiment of the present application includes a method for implementing container image caching between Kubernetes nodes in an intranet environment. The method loads the image in advance by caching and preheating, improves the speed of creating large-volume containers, and can quickly create containers.

[0073] Figure 6 The following is a flow chart of a method for caching container images between Kubernetes nodes. The method may include:

[0074] S601. Implement Kubernetes' CRD according to the Kubernetes specification and the standard interface provided as the specific task execution program for image layer cache. Write deployment files and define cache strategies.

[0075] S602, deploy cache policy. Use the deployment file to register cache-related CRDs in the Kubernetes cluster. Use the deployment file to create an image cache acceleration policy (referred to as cache policy) in the Kubernetes cluster.

[0076] S603: The image manager checks whether the target image exists in the cluster. If yes, execute S607; otherwise, execute S604.

[0077] S604, the image manager selects a node to issue a pull task to obtain the target image from the outside. If no node has the target image, a node is directly selected to download (pull) the target image from the network.

[0078] S605: The task manager that receives the pull task pulls the target image for the node.

[0079] S606: Determine whether the pull is successful, if yes, execute S607, otherwise execute S605.

[0080] S607, the image manager parses the image layer file and generates an image cache task. The image manager traverses all nodes in the cluster according to the cache strategy, selects the node with the target image, and analyzes the image layer file. According to the situation of each node, a cache task is created for other nodes, specifying where to cache and which layers need to be cached.

[0081] S608: The image manager sends synchronization image tasks (or image cache tasks) to other nodes.

[0082] S609, the task manager synchronizes images for the nodes. For example, the task manager executes the received image cache task. There is a task manager on each node of the cluster. The task manager listens to the image synchronization or download tasks related to this node. When a task is sent to the current node, the task manager executes the task according to the task information, runs a container to execute the cache task and updates the task status.

[0083] S610: Determine whether the task synchronization is successful, if yes, then end, otherwise continue to execute S609.

[0084] Figure 7 1 is a schematic diagram of a mirror processing device according to an embodiment of the present disclosure. In one embodiment, the device includes:

[0085] The first parsing module 701 is used to parse the image layer file of the target image and generate an image cache task when the image manager detects that the target image exists on the first node of the cluster;

[0086] The synchronization module 702 is used to send the image cache task to the task manager of the second node through the image manager, so as to synchronize the image layer file of the target image to the second node through the task manager.

[0087] Figure 8 : is a schematic diagram of the structure of an image processing device according to another embodiment of the present disclosure. The device may include one or more features of the above-mentioned image processing device. In one embodiment, the device also includes:

[0088] The pulling module 801 is used for sending a pulling task of the target image to a third node of the cluster through the image manager when the target image does not exist in all nodes of the cluster, so as to pull the target image for the third node from outside the cluster through the task manager of the third node;

[0089] The second parsing module 802 is used to parse the image layer file of the target image through the image manager when the target image is successfully pulled.

[0090] In one embodiment, Figure 8 As shown, the device also includes:

[0091] The retrieval module 803 is used to determine whether the target image exists on the node of the cluster according to the basic information of the target image in the image cache policy and the node cache status in the database of the cluster through the image manager.

[0092] In one embodiment, Figure 8 As shown, the device also includes:

[0093] The custom resource module 804 is used to register the cache-related customer resource definition CRD in the cluster through the deployment file to deploy the image cache strategy in the cluster; wherein the image cache strategy includes at least one of the following:

[0094] The name and version of the target image;

[0095] The time to execute the image cache task;

[0096] The target image pulling method includes one of the following: re-pulling the target image each time; pulling the target image when the target image does not exist on all nodes in the cluster.

[0097] In one embodiment, the image manager is used to manage images of one or more nodes in the cluster, and the task manager is used to run a container on each node to perform the image cache task.

[0098] In one implementation, the image cache task includes at least one of the following:

[0099] The node where the target image is located;

[0100] The name of the target image;

[0101] The version of the target image;

[0102] The node that needs to synchronize the target image;

[0103] Information about the associated cache policy.

[0104] In one implementation, the master node of the cluster includes the image manager, and the master node and the working node of the cluster include the task manager.

[0105] In one embodiment, Figure 8 As shown, the cluster includes multiple image managers, and the device also includes:

[0106] The election module 805 is used for other image managers on the master node of the cluster to re-elect the master image manager.

[0107] For the description of specific functions and examples of each module and submodule of the device in the embodiment of the present disclosure, reference can be made to the relevant description of the corresponding steps in the above method embodiment, which will not be repeated here.

[0108] Fig. 9 FIG. 1 is a structural block diagram of an electronic device according to an embodiment of the present disclosure. Fig. 9 As shown, the electronic device includes: a memory 910 and a processor 920, and the memory 910 stores a computer program that can be run on the processor 920. The number of memories 910 and processors 920 can be one or more. The memory 910 can store one or more computer programs. When the one or more computer programs are executed by the electronic device, the electronic device executes the method provided by the above method embodiment. The electronic device may also include: a communication interface 930, which is used to communicate with external devices and perform data exchange transmission.

[0109] If the memory 910, the processor 920 and the communication interface 930 are implemented independently, the memory 910, the processor 920 and the communication interface 930 can be connected to each other through a bus and communicate with each other. The bus can be an Industry Standard Architecture (ISA) bus, a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus. The bus can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, Fig. 9 Only one thick line is used in the diagram, but this does not mean that there is only one bus or only one type of bus.

[0110] Optionally, in a specific implementation, if the memory 910, the processor 920 and the communication interface 930 are integrated on a chip, the memory 910, the processor 920 and the communication interface 930 can communicate with each other through an internal interface.

[0111] It should be understood that the processor may be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field programmable gate arrays (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor may be a microprocessor or any conventional processor, etc. It is worth noting that the processor may be a processor supporting the Advanced RISC Machines (ARM) architecture.

[0112] Further, optionally, the above-mentioned memory may include a read-only memory and a random access memory, and may also include a non-volatile random access memory. The memory may be a volatile memory or a non-volatile memory, or may include both volatile and non-volatile memories. Among them, the non-volatile memory may include a read-only memory (ROM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), an electrically erasable programmable read-only memory (EEPROM), or a flash memory. The volatile memory may include a random access memory (RAM), which is used as an external cache. By way of example but not limitation, many forms of RAM are available. For example, static random access memory (SRAM), dynamic random access memory (DRAM), synchronous dynamic random access memory (SDRAM), double data rate synchronous dynamic random access memory (DDR SDRAM), enhanced synchronous dynamic random access memory (ESDRAM), synchronous link dynamic random access memory (SLDRAM) and direct memory bus random access memory (DR RAM).

[0113] In the above embodiments, it can be implemented in whole or in part by software, hardware, firmware or any combination thereof. When implemented using software, it can be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer instructions are loaded and executed on a computer, the process or function described in the embodiment of the present disclosure is generated in whole or in part. The computer can be a general-purpose computer, a special-purpose computer, a computer network or other programmable device. The computer instructions can be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium. For example, the computer instructions can be transmitted from a website site, computer, server or data center by wired (for example: coaxial cable, optical fiber, data subscriber line (Digital Subscriber Line, DSL)) or wireless (for example: infrared, Bluetooth, microwave, etc.) mode to another website site, computer, server or data center. The computer-readable storage medium can be any available medium that a computer can access, or a data storage device such as a server or data center that includes one or more available media integrations. The available medium may be a magnetic medium (e.g., a floppy disk, a hard disk, a magnetic tape), an optical medium (e.g., a digital versatile disc (DVD)), or a semiconductor medium (e.g., a solid state disk (SSD)), etc. It is worth noting that the computer-readable storage medium mentioned in the present disclosure may be a non-volatile storage medium, in other words, a non-transient storage medium.

[0114] A person skilled in the art will understand that all or part of the steps to implement the above embodiments may be accomplished by hardware or by instructing related hardware through a program, and the program may be stored in a computer-readable storage medium, and the above-mentioned storage medium may be a read-only memory, a disk or an optical disk, etc.

[0115] In the description of the embodiments of the present disclosure, the description with reference to the terms "one embodiment", "some embodiments", "example", "specific example", or "some examples" means that the specific features, structures, materials or characteristics described in conjunction with the embodiment or example are included in at least one embodiment or example of the present disclosure. Moreover, the specific features, structures, materials or characteristics described may be combined in any one or more embodiments or examples in a suitable manner. In addition, those skilled in the art may combine and combine the different embodiments or examples described in this specification and the features of the different embodiments or examples, unless they are contradictory.

[0116] In the description of the embodiments of the present disclosure, unless otherwise specified, " / " means or, for example, A / B can mean A or B. "And / or" in this article is only a way to describe the association relationship of associated objects, indicating that there can be three relationships, for example, A and / or B can mean: A exists alone, A and B exist at the same time, and B exists alone.

[0117] In the description of the embodiments of the present disclosure, the terms "first" and "second" are used for descriptive purposes only and are not to be understood as indicating or implying relative importance or implicitly indicating the number of the indicated technical features. Thus, a feature defined as "first" or "second" may explicitly or implicitly include one or more of the features. In the description of the embodiments of the present disclosure, unless otherwise specified, "plurality" means two or more.

[0118] The above description is only an exemplary embodiment of the present disclosure and is not intended to limit the present disclosure. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present disclosure shall be included in the protection scope of the present disclosure.

Claims

1. A mirror processing method, comprising: When the image manager detects that the target image exists on the first node of the cluster, the image layer file of the target image is parsed, and an image cache task is generated; The image cache task is sent to the task manager of the second node through the image manager, so that the image layer file of the target image is synchronized to the second node through the task manager.

2. The method according to claim 1, wherein: The method further comprises: In a case where the target image does not exist in all nodes of the cluster, issuing a task for pulling the target image to a third node of the cluster through the image manager, so that the task manager of the third node pulls the target image for the third node from outside the cluster; When the target image is pulled successfully, the image layer file of the target image is parsed by the image manager.

3. The method according to claim 1, wherein: The method further comprises: The image manager determines whether the target image exists on the node of the cluster according to the basic information of the target image in the image cache strategy and the node cache status in the database of the cluster.

4. The method according to claim 3, wherein: The method further comprises: Registering cache-related customer resource definitions (CRDs) in the cluster through a deployment file to deploy an image cache strategy in the cluster; wherein the image cache strategy includes at least one of the following: The name and version of the target image; The time to execute the image cache task; The target image pulling method includes one of the following: re-pulling the target image each time; pulling the target image when the target image does not exist on all nodes in the cluster.

5. The method according to any one of claims 1 to 4, wherein: The image manager is used to manage the images of one or more nodes in the cluster, and the task manager is used to run a container on each node to execute the image cache task.

6. The method according to any one of claims 1 to 4, wherein: The image cache task includes at least one of the following: The node where the target image is located; The name of the target image; The version of the target image; The node that needs to synchronize the target image; Information about the associated cache policy.

7. The method according to any one of claims 1 to 4, wherein: The master node of the cluster includes the image manager, and the master node and the working node of the cluster include the task manager.

8. The method according to any one of claims 1 to 4, wherein: The cluster includes a plurality of image managers, and the method further includes: When the master image manager of the cluster is abnormal, other image managers re-elect the master image manager.

9. An image processing device, comprising: A first parsing module, configured to parse an image layer file of the target image and generate an image cache task when the image manager detects that the target image exists on the first node of the cluster; A synchronization module is used to send the image cache task to the task manager of the second node through the image manager, so as to synchronize the image layer file of the target image to the second node through the task manager.

10. The device according to claim 9, wherein: The device also includes: A pulling module, configured to, when the target image does not exist in all nodes of the cluster, issue a pulling task of the target image to a third node of the cluster through the image manager, so as to pull the target image for the third node from outside the cluster through the task manager of the third node; The second parsing module is used to parse the image layer file of the target image through the image manager when the target image is successfully pulled.

11. The device according to claim 9, wherein: The device also includes: The retrieval module is used to determine whether the target image exists on the node of the cluster according to the basic information of the target image in the image cache strategy and the node cache status in the database of the cluster through the image manager.

12. The device according to claim 11, wherein The device also includes: A custom resource module is used to register cache-related customer resource definitions (CRDs) in the cluster through a deployment file to deploy an image cache strategy in the cluster; wherein the image cache strategy includes at least one of the following: The name and version of the target image; The time to execute the image cache task; The target image pulling method includes one of the following: re-pulling the target image each time; pulling the target image when the target image does not exist on all nodes in the cluster.

13. The device according to any one of claims 9 to 12, wherein: The image manager is used to manage the images of one or more nodes in the cluster, and the task manager is used to run a container on each node to execute the image cache task.

14. The device according to any one of claims 9 to 12, wherein: The image cache task includes at least one of the following: The node where the target image is located; The name of the target image; The version of the target image; The node that needs to synchronize the target image; Information about the associated cache policy.

15. The device according to any one of claims 9 to 12, wherein: The master node of the cluster includes the image manager, and the master node and the working node of the cluster include the task manager.

16. The device according to any one of claims 9 to 12, wherein: The cluster includes a plurality of image managers, and the device further includes: The election module is used for re-electing the main image manager by other image managers when the main image manager of the cluster is abnormal.

17. An electronic device comprising: at least one processor; as well as a memory communicatively connected to the at least one processor; wherein, The memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to perform the method according to any one of claims 1 to 8.

18. A non-transitory computer-readable storage medium storing computer instructions, wherein: The computer instructions are used to cause the computer to execute the method according to any one of claims 1-8.

19. A computer program product, comprising a computer program, which, when executed by a processor, implements the method according to any one of claims 1 to 8.

Citation Information

Patent Citations

  • Mirror image caching method and device, electronic equipment and storage medium

    CN114489937A

  • Mirror layer P2P (Peer-to-Peer) sharing transmission method and system based on Kubernetes scheduling scheme

    CN116737317A

  • Container mirror image deployment method and device, terminal and medium

    CN116880951A

  • Mirror image proxy method, device and system, computer equipment and storage medium

    CN117527826A

  • Image pulling method and related product

    WO2021232289A1

Cited By

  • Distributed operating system mirror image distribution and atomic upgrading method and system based on p2p Mesh network

    CN122698600A

  • A Distributed Operating System Image Distribution and Atomic Upgrade Method and System Based on P2P Mesh Network

    CN122698600B