Mirror image warehouse high availability implementation method and device based on block protocol CSI

By connecting to the block protocol CSI plug-in in the k8s cluster, creating PVC resources with appropriate access modes, solving the problems of high availability and deployment complexity of mirror warehouses, and achieving an efficient and general high availability solution for mirror warehouses.

CN119829220APending Publication Date: 2025-04-15CHINA ELECTRONICS CLOUD DIGITAL INTELLIGENCE TECH CO LTD
View PDF 0 Cites 1 Cited by

Patent Information

Application Number
CN202510096844.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-01-22
Publication Date
2025-04-15

AI Technical Summary

Technical Problem

When implementing high availability of mirror warehouses, the prior art requires additional deployment processes and complex configurations, and the direct use of block protocols cannot meet the high availability scenarios, because multi-node writing will lead to data inconsistency.

Method used

By deploying the k8s cluster and docking the block protocol CSI plug-in, we create PVC resources in ReadWriteOnce and ReadOnlyMany modes, which are used for image import and pulling, respectively, to ensure high availability and avoid multi-node writing at the file system level.

Benefits of technology

It realizes high availability of mirror warehouse services, simplifies the deployment process, applies to the block protocol CSI plug-in provided by all vendors, and extends to other service scenarios that require high availability.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119829220A_ABST
    Figure CN119829220A_ABST
Patent Text Reader

Abstract

The invention relates to a method and a device for realizing high availability of a mirror image warehouse based on block protocol CSI (Channel State Information). The method comprises the following steps: deploying a k8s cluster, and docking a block protocol CSI plug-in; creating a storage medium A of a mirror image warehouse on the back-end storage; the method comprises the following steps: establishing a PVC resource write-pvc, configuring the PVC resource write-pvc as ReadWriteOnce, establishing a PV resource write-pv, mapping the PV resource write-pv to a storage medium A, and binding the write-pvc and the write-pv; creating a pod for importing a mirror image, and mounting the write-pvc to the pod in an RW mode; the method comprises the following steps: establishing a PVC resource read-pvc, configuring the PVC resource read-pvc as ReadOnlyMany, establishing a PV resource read-pv, mapping the PV resource read-pv to a storage medium A, and binding the read-pvc and the read-pv; and creating a pod for pulling a mirror image, configuring the pod as a Deployment multi-copy type, configuring a host selection mechanism, mounting read-pvc to the pod in an RO mode, and marking the read-pvc as read-only. The method has high convenience, high universality and high expansibility, high availability of the mirror image warehouse service can be realized based on the block protocol, and the method is applicable to block protocol CSI plug-ins provided by all manufacturers.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application belongs to the field of image service technology, and in particular to a method, device, computer-readable storage medium and electronic device for implementing high availability of an image repository based on a block protocol CSI. Background Art

[0002] The image warehouse can provide the most basic image pulling service for each container in the k8s cluster. The implementation solution is to use the PVC provided by CSI as the storage medium for image data.

[0003] At present, in most scenarios, the docking of CSI backend storage uses object or file services (such as MinIO, etc.) to achieve high availability of image services and ensure data consistency in high availability scenarios. However, these services require additional construction or deployment processes based on bare disks, which makes docking more cumbersome.

[0004] On the other hand, if you want to avoid additional deployment processes and directly use the block protocol to provide the bare disk for docking, it cannot meet the high availability scenario, because high availability means mounting a volume to multiple k8s cluster nodes in read-write mode at the same time. Even if only one node actually sends business data, other nodes will cause data inconsistency due to the refresh of file system metadata. In serious cases, the entire file system will be damaged and the image warehouse service will be unusable. In addition, most of the CSI block protocol plug-ins of various manufacturers currently do not support multi-node reading and writing, and the above method is inconvenient to implement. Summary of the invention

[0005] In order to address the above problems, this application proposes a new method for implementing high availability of image warehouses based on the block protocol CSI. This application provides the following technical solutions: A first aspect of the present application provides a method for implementing high availability of an image repository based on a block protocol CSI, the method comprising: Deploy the k8s cluster and connect to the block protocol CSI plug-in; Plan a block device or volume resource (determined by the implementation of different storage vendors) on the backend storage as the storage medium A of the image repository; Create a PVC resource write-pvc and set the access mode to ReadWriteOnce (single-node read and write permissions). Select the manual connection method, create another PV resource write-pv, map it to storage medium A, and configure the same storageclass and capacity information as write-pvc so that write-pvc and write-pv can be successfully matched and bound. Create a pod for importing images from the image repository, configure it as a DaemonSet type or a Deployment single-replica type, and mount the PVC resource write-pvc to the pod in RW (read-write) mode; Create a PVC resource read-pvc and set the access mode to ReadOnlyMany (multi-node read-only permission). Create a PV resource read-pv and map it to storage medium A. Configure the same storageclass and capacity information as read-pvc so that read-pvc and read-pv can be successfully matched and bound. Create a pod for pulling images from the image repository, configure it as a Deployment with multiple replicas, configure the master election mechanism to ensure high availability of the image repository service, mount the PVC resource read-pvc to the pod in RO (read-write) mode, and mark the mount mode as read-only to avoid multi-node writes at the file system level. The image repository service is now set up.

[0006] Optionally, the method of the present application also includes: if you choose to automatically generate storage medium A, there is no need to create PV resource write-pv, you only need to wait for CSI tuning and automatically interact with the backend storage to create PV resources and storage medium A.

[0007] Optionally, the method of the present application also includes: importing the image service deployment as a single-copy write-pod, and pulling the image service deployment as a multi-copy read-pod.

[0008] Optionally, the method of the present application further includes: connecting write-pv and read-pv to the same storage medium A of the backend storage by configuring the same volumeHandle; Bind write-pv and read-pv to write-pvc and read-pvc respectively; Mount write-pvc to write-pod as the storage medium for persistent image data of the image data import service; Mount read-pvc to read-pod as the data source for the image pull service.

[0009] Optionally, the method of the present application also includes: when importing an image, writing the image data through the services and interfaces provided by write-pod, and the completion of writing triggers the file system cache to be written to the disk, which then triggers the data synchronization of read-pod of each node; when pulling the image, reading the image data is realized through the services and interfaces provided by read-pod.

[0010] Optionally, in the method of the present application, the file system cache is written to the disk by restarting the write-pod or executing sync; The data synchronization of the read-pod of each node is carried out by restarting the read-pod or triggering re-mounting to refresh the file system metadata.

[0011] A second aspect of the present application provides a device for implementing high availability of an image repository based on a block protocol CSI, the device comprising: Cluster deployment module: used to deploy k8s clusters and connect to the block protocol CSI plug-in; Storage creation module: used to plan a block device or volume resource on the backend storage as the storage medium A of the image warehouse; The first PVC creation module is used to create a PVC resource write-pvc and configure it to the ReadWriteOnce (single-node read and write permission) access mode. The manual connection method is selected, and then a PV resource write-pv is created and mapped to storage medium A. The storageclass and capacity information are configured the same as those of write-pvc, so that write-pvc and write-pv can be successfully matched and bound. Import image pod creation module: used to create a pod for importing images from an image repository. It is configured as a DaemonSet type or a Deployment single-copy type, and the PVC resource write-pvc is mounted to the pod in RW (read-write) mode. The second PVC creation module is used to create a PVC resource read-pvc and configure it as ReadOnlyMany (multi-node read-only permission) access mode; then create a PV resource read-pv and map it to storage medium A, and configure the same storageclass and capacity information as read-pvc so that read-pvc and read-pv can be successfully matched and bound; Image pulling pod creation module: used to create a pod for pulling images from the image repository, configured as a Deployment multi-copy type, configured a master election mechanism to ensure high availability of the image repository service, and mounted the PVC resource read-pvc to the pod in RO (read-write) mode. The mount mode is marked as read-only to avoid multi-node writes at the file system level, thus completing the construction of the image repository service.

[0012] The device implements the steps of the aforementioned method for implementing high availability of an image repository based on the block protocol CSI when running.

[0013] A third aspect of the present application provides an electronic device, comprising: a memory and a processor; Memory: used to store computer programs; Processor: used to execute the computer program to implement the steps of the aforementioned method for implementing high availability of image warehouse based on block protocol CSI.

[0014] A fourth aspect of the present application provides a computer-readable storage medium having a computer program stored thereon. When the computer program is executed by a processor, the steps of the aforementioned method for implementing high availability of an image repository based on the block protocol CSI are implemented.

[0015] In summary, the high availability implementation method of the image warehouse based on the block protocol CSI in this application has the following characteristics: (1) Convenience: High availability of image repository services can be achieved based on the block protocol; (2) Universality: It is applicable to block protocol CSI plug-ins provided by all manufacturers; (3) Scalability: In addition to the image repository service specifically mentioned in this article, this solution can be used in similar service scenarios that require high availability.

[0016] Other features and advantages of the present application will be described in the following description, or understood by practicing the present application. The purpose and other advantages of the present application can be realized and obtained by the techniques indicated in the description, claims and drawings. BRIEF DESCRIPTION OF THE DRAWINGS

[0017] In order to more clearly illustrate the technical solutions of the embodiments of the present application, a brief introduction will be given below to the drawings required for use in the description of the embodiments. Obviously, the drawings described below are only some embodiments of the present application. For those skilled in the art, other drawings can be obtained based on these drawings without creative work.

[0018] Figure 1 This is an overall implementation flow chart of the high availability implementation method of the image repository based on the block protocol CSI of this application.

[0019] Figure 2 This is a schematic diagram of the operating architecture of the image repository docking block protocol CSI high availability solution for this application.

[0020] Figure 3 This is a composition structure diagram of the image repository high availability implementation device based on the block protocol CSI in this application.

[0021] Figure 4 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0022] In order to make the purpose, technical solution and advantages of the embodiments of the present application clearer, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those skilled in the art without making creative work are within the scope of protection of this application.

[0023] As used herein, the term “including” and its variations are open inclusions, ie, “including but not limited to”; the term “based on” means “based at least in part on”; and the term “one embodiment” means “at least one embodiment”.

[0024] It should be noted that the modifications of "one" and "plurality" mentioned in the present application are illustrative rather than restrictive, and those skilled in the art should understand that unless the context clearly indicates otherwise, it should be understood as "one or more".

[0025] Terminology explanation: CSI (Container Storage Interface): is a standard plug-in interface for Kubernetes that allows third-party storage providers to develop custom storage plug-ins without modifying the Kubernetes core code. The goal of CSI is to provide a standardized interface that enables storage vendors to more easily integrate their storage systems into Kubernetes.

[0026] PV: A storage resource in a cluster that can be created by an administrator or dynamically created using StorageClass. It defines rules such as storage capacity, access mode, and backend storage.

[0027] PVC: is a user's request for storage. PVC will be bound to a suitable PV to provide storage space for the application.

[0028] volumeHandle: is a string value that uniquely identifies the volume name returned from the CSI plugin's CreateVolume call; it must correspond to the value returned by the CSI driver in the volume_id field of CreateVolumeResponse; volumeHandle is used to reference the volume in all subsequent calls to the volume driver.

[0029] Figure 1 The overall implementation process of the high availability implementation method of the image repository based on the block protocol CSI provided by this application is shown, including the following steps: Deploy the k8s cluster and connect to the block protocol CSI plug-in; Plan a block device or volume resource (determined by the implementation of different storage vendors) on the backend storage as the storage medium A of the image repository; Create a PVC resource write-pvc and configure it to the ReadWriteOnce (single-node read-write permission) access mode. Select the manual connection method, create another PV resource write-pv, and map it to storage medium A. Configure the same storageclass and capacity information as write-pvc, and bind write-pvc and write-pv. Create a pod for importing images from the image repository, configure it as a DaemonSet type or a Deployment single-replica type, and mount the PVC resource write-pvc to the pod in RW (read-write) mode; Create a PVC resource read-pvc and configure it to the ReadOnlyMany (multi-node read-only permission) access mode. Create a PV resource read-pv and map it to storage medium A. Configure the same storageclass and capacity information as read-pvc, and bind read-pvc and read-pv. Create a pod for pulling images from the image repository, configure it as a Deployment with multiple replicas, configure the master election mechanism to ensure high availability of the image repository service, mount the PVC resource read-pvc to the pod in RO (read-write) mode, and mark the mount mode as read-only to avoid multi-node writes at the file system level. The image repository service is now set up.

[0030] Specifically, this method includes the following steps: Step 1: The k8s cluster is deployed and the block protocol CSI plug-in is connected; Step 2: Manually generate storage media (skip this step if you choose to generate automatically). Plan a block device or volume resource (determined by the implementation of different storage vendors) on the backend storage as the storage medium of the image repository, assuming it is volume A. Step 3: Create a PVC resource (assuming it is write-pvc) and configure it as ReadWriteOnce (single-node read and write permissions). If you choose the manual docking method, you need to manually create a PV resource (assuming it is write-pv) and map it to the storage medium (volume A) created in step 2. Configure the same storageclass and capacity information as write-pvc to ensure that write-pvc and write-pv can be successfully matched and bound. If you choose automatic generation, you do not need to create a PV. You only need to wait for CSI tuning to automatically interact with the backend storage to create a PV and backend storage medium (volume A). Step 4: Create a pod for importing images from the image repository, configure it as DaemonSet type or Deployment single replica type, and mount the PVC (write-pvc) created in step 3 to the pod in RW (read-write) mode; Step 5: Create a PVC resource (assuming it is read-pvc) and configure it as ReadOnlyMany (multi-node read-only permission). Then manually create a PV resource (assuming it is read-pv) and map it to the storage medium (volume A) created in step 2. Configure the same storageclass and capacity information as read-pvc to ensure that the above read-pvc and read-pv can be successfully matched and bound. Step 6: Create a pod for pulling images from the image repository, configure it as a Deployment with multiple replicas, configure the master election mechanism to ensure high availability of the image repository service, and mount the PVC (read-pvc) created in step 5 to the pod in RO (read-write) mode to ensure read-only access and avoid multi-node writes at the file system level.

[0031] After completing the above steps, the image warehouse service is set up. When importing an image, the image data is written through the services and interfaces provided by write-pod. After writing, the file system cache is triggered to be written to the disk (such as restarting write-pod, executing sync, etc.), and then the data synchronization of read-pod on each node is triggered (such as restarting read-pod, triggering re-mount to refresh the file system metadata, etc.); when pulling an image, the image data can be read through the services and interfaces provided by read-pod.

[0032] Figure 2 The following is the operating architecture of the CSI high availability solution for the image repository docking block protocol of this application, including: 1. Import the image service to deploy a single-copy write-pod, and pull the image service to deploy N-copy read-pod; 2. Create write-pvc with access mode set to ReadWriteOnce (single-node read-write mode), and create read-pvc with access mode set to ReadOnlyMany (multi-node read-only mode); 3. Create two PVs, write-PV and read-PV, respectively, and connect them to the same volume or block device (volume A) of the backend storage by configuring the same volumeHandle; 4. Write-pv and read-pv are bound to write-pvc and read-pvc respectively; 5. Mount write-pvc to write-pod as the storage medium for persistent image data of the image data import service; 6. Mount read-pvc to read-pod as the data source for the image pull service.

[0033] The above solution avoids the data inconsistency problem caused by multi-node writing of block services, and at the same time achieves high availability of image pull services.

[0034] In order to better understand the technical solution of the present application, the specific implementation solution of high availability of the image warehouse docking block service is further described in detail with the following scenario embodiments: The image warehouse service provides the functions of image data import and image pulling. In private cloud or public cloud scenarios, the dependent images of various basic components, application stores and other services will be imported into the image warehouse service in the cluster at the beginning of cluster deployment. When the basic components are started or users add new applications, the images that the pods start to depend on need to be pulled from the image warehouse. At the same time, in order to prevent the image warehouse service from being paralyzed due to node failures, the high availability of the image pulling service needs to be guaranteed.

[0035] (Prerequisite) The block service CSI plug-in has been started, and storageclass resources (such as sc-example) have been created and connected to the backend storage.

[0036] (1) Create a PVC resource, using the dynamic creation method (automatically creating a backend storage medium), the PVC name is image-data-upload, and the accessMode (access mode) uses ReadWriteOnce (single-node read and write):

[0037] Deploy the above PVC template to generate PVC, and automatically tune and call CreateVolume of CSI plug-in to obtain volumeHandle and other information to generate PV (assuming the name is pvc-uuid) and automatically bind it to the storage backend volume. The volume name is the same as the PV name (pvc-uuid). (2) Create a Deployment template for importing the image, name it registry-image-upload, specify the number of replicas as 1, and mount the PVC created in (1):

[0038] Deploy the above Deployment template and import the image that starts a single copy into the service pod; (3) All image data is written to the container mount directory / var / lib / registry through the image import service, and then the pod is restarted to trigger the unloading of the PVC, so that the file system cache is written to the disk and all data falls into the volume of the storage backend; (4) Copy the PV generated in (1), change its name to cp-pvc-uuid, volumeHandle to pvc-uuid, and accessMode to ReadOnlyMany:

[0039] Deploy the above PV template to obtain a multi-node read-only PV named cp-pvc-uuid; (5) Create a PVC resource with the PVC name image-data-vol, set accessMode to ReadOnlyMany (multi-node read-only), and specify volumeName as cp-pvc-uuid:

[0040] Deploy the above template to obtain a multi-node read-only PVC. This PVC is bound to the PV copied in (4) and is mapped to the same backend storage volume pvc-uuid as the PVC created in (1). (6) Create a Deployment resource for pulling images, named registry-image-server, specify the number of replicas as 3, mount the PVC created in (5), and mark the mount mode as read-only:

[0041] Deploying the above Deployment template will start three copies of the image pull service pod.

[0042] The above image repository service is deployed. The pod pulled up by registry-image-server provides image pulling service, and the PVC named image-data-vol will be used as the image data source.

[0043] Figure 3 The present application shows a high-availability image repository implementation device based on the block protocol CSI, including: Cluster deployment module: used to deploy k8s clusters and connect to the block protocol CSI plug-in; Storage creation module: used to plan a block device or volume resource on the backend storage as the storage medium A of the image warehouse; The first PVC creation module: used to create a PVC resource write-pvc, configured with the ReadWriteOnce (single-node read-write permission) access mode; select the manual connection method, create a PV resource write-pv, and map it to storage medium A, configure the same storageclass and capacity information as write-pvc, and bind write-pvc and write-pv; Import image pod creation module: used to create a pod for importing images from an image repository. It is configured as a DaemonSet type or a Deployment single-copy type, and the PVC resource write-pvc is mounted to the pod in RW (read-write) mode. The second PVC creation module is used to create a PVC resource read-pvc and configure it as ReadOnlyMany (multi-node read-only permission) access mode; then create a PV resource read-pv and map it to storage medium A, configure the same storageclass and capacity information as read-pvc, and bind read-pvc and read-pv; Image pulling pod creation module: used to create a pod for pulling images from the image repository, configured as a Deployment multi-copy type, configured a master election mechanism to ensure high availability of the image repository service, and mounted the PVC resource read-pvc to the pod in RO (read-write) mode. The mount mode is marked as read-only to avoid multi-node writes at the file system level, thus completing the construction of the image repository service.

[0044] When the above device is running, the steps of the method for implementing high availability of an image repository based on the block protocol CSI disclosed in this application are implemented.

[0045] The flow chart and block diagram in the accompanying drawings illustrate the possible architecture, function and operation of the device, method and computer program product according to various embodiments of the present application. In this regard, each square box in the flow chart or block diagram can represent a module, program segment or a part of code, and the module, program segment or a part of code contains one or more executable instructions for realizing the specified logical function. It should also be noted that each square box in the block diagram and / or flow chart, and the combination of the square boxes in the block diagram and / or flow chart can be realized by a special hardware-based system that performs the specified function or operation, or can be realized by a combination of special hardware and computer instructions.

[0046] like Figure 4As shown, the embodiment of the present application also discloses an electronic device, including: a processor 310, a communication interface 320, a memory 330 for storing a processor executable computer program, and a communication bus 340. The processor 310, the communication interface 320, and the memory 330 communicate with each other through the communication bus 340. The processor 310 runs the executable computer program to implement the steps of the above-mentioned method for implementing high availability of an image repository based on the block protocol CSI.

[0047] It is understandable that, in addition to the memory and the processor, the electronic device may also include an input device such as a keyboard, an output device such as a display, and other communication modules. The input device, the output device, and other communication modules communicate with the processor via an I / O interface (i.e., an input / output interface).

[0048] Computer program code for performing the operations of the present application may be written in one or more programming languages ​​or a combination thereof, including, but not limited to, object-oriented programming languages, such as Java, Smalltalk, C++, and conventional procedural programming languages, such as "C" or similar programming languages. The program code may be executed entirely on the user's computer, partially on the user's computer, as a separate software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In cases involving a remote computer, the remote computer may be connected to the user's computer via any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (e.g., via the Internet using an Internet service provider).

[0049] Furthermore, the present application also discloses a computer-readable storage medium. When the instructions in the computer-readable storage medium are executed by a processor of an electronic device, the electronic device can execute the various steps of the high-availability implementation method of the image repository based on the block protocol CSI disclosed in the present application.

[0050] In the context of the present application, a computer-readable storage medium may be a tangible medium, more specific examples of which would include a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.

[0051] In particular, according to an embodiment of the present application, the process described in the flowchart can be implemented as a computer software program. For example, an embodiment of the present application includes a computer program product, which includes a computer program carried on a non-transitory computer-readable medium, and the computer program contains program code for executing the high-availability implementation method of the image warehouse based on the block protocol CSI disclosed in the present application. When the computer program is executed by the processing device, the above functions defined in the method of the embodiment of the present application are executed.

[0052] Although several specific implementation details are included in the above discussion, these should not be interpreted as limiting the scope of the present application. The above description is only a preferred embodiment of the present application and an explanation of the technical principles used. Those skilled in the art should understand that the scope of disclosure involved in the present application is not limited to the technical solutions formed by a specific combination of the above technical features, but also should cover other technical solutions formed by any combination of the above technical features or their equivalent features without departing from the above public concept.

[0053] Those skilled in the art should also understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein; and these modifications or replacements do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of this application.

Claims

1. A method for implementing high availability of an image repository based on a block protocol CSI, characterized in that: The method comprises: Deploy the k8s cluster and connect to the block protocol CSI plug-in; Plan a block device or volume resource on the backend storage as storage medium A for the image repository; Create a PVC resource write-pvc and set the access mode to ReadWriteOnce. Select the manual connection method, create another PV resource write-pv, map it to storage medium A, configure the same storageclass and capacity information as write-pvc, and bind write-pvc and write-pv. Create a pod for importing images from the image repository, configure it as a DaemonSet type or a Deployment single-copy type, and mount the PVC resource write-pvc to the pod in RW mode; Create a PVC resource read-pvc and set the access mode to ReadOnlyMany. Create a PV resource read-pv and map it to storage medium A. Configure the same storageclass and capacity information as read-pvc and bind read-pvc and read-pv. Create a pod for pulling images from the image repository, configure it as a Deployment with multiple replicas, configure the master election mechanism, mount the PVC resource read-pvc to the pod in RO mode, mark the mount mode as read-only, and the image repository service is set up.

2. The method according to claim 1, characterized in that The method further includes: if the storage medium A is automatically generated, there is no need to create the PV resource write-pv, and only needs to wait for CSI tuning, and automatically interact with the backend storage to create the PV resource and the storage medium A.

3. The method according to claim 1, characterized in that The method further includes: importing the image service deployment as a single-copy write-pod, and pulling the image service deployment as a multi-copy read-pod.

4. The method according to claim 3, characterized in that The method further includes: connecting write-pv and read-pv to the same storage medium A of backend storage by configuring the same volumeHandle; Bind write-pv and read-pv to write-pvc and read-pvc respectively; Mount write-pvc to write-pod as the storage medium for persistent image data of the image data import service; Mount read-pvc to read-pod as the data source for the image pull service.

5. The method according to claim 1, characterized in that The method also includes: when importing an image, writing the image data through the service and interface provided by write-pod, triggering the file system cache to be written to the disk after writing, and then triggering the data synchronization of read-pod of each node; when pulling the image, reading the image data through the service and interface provided by read-pod.

6. The method according to claim 5, characterized in that The file system cache is written to disk by restarting the write-pod or executing sync; The data synchronization of the read-pod of each node is carried out by restarting the read-pod or triggering re-mounting to refresh the file system metadata.

7. A high-availability implementation device for an image repository based on a block protocol CSI, characterized in that: The device comprises: Cluster deployment module: used to deploy k8s clusters and connect to the block protocol CSI plug-in; Storage creation module: used to plan a block device or volume resource on the backend storage as the storage medium A of the image warehouse; The first PVC creation module: used to create a PVC resource write-pvc, with the access mode configured as ReadWriteOnce; select the manual connection method, create a PV resource write-pv, and map it to storage medium A, configure the same storageclass and capacity information as write-pvc, and bind write-pvc and write-pv; Import image pod creation module: used to create a pod for importing images from the image repository, configured as DaemonSet type or Deployment single replica type, and mount the PVC resource write-pvc to the pod in RW mode; The second PVC creation module is used to create a PVC resource read-pvc, with the access mode configured as ReadOnlyMan; then create a PV resource read-pv, map it to storage medium A, configure the same storageclass and capacity information as read-pvc, and bind read-pvc and read-pv; Image pulling pod creation module: used to create a pod for pulling images from the image repository, configure it as a Deployment multi-copy type, configure the master election mechanism, mount the PVC resource read-pvc to the pod in RO mode, mark the mount mode as read-only, and complete the construction of the image repository service.

8. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method for implementing high availability of an image repository based on the block protocol CSI as described in any one of claims 1 to 6 are implemented.

9. An electronic device, characterized in that: include: Memory and processor; Memory: used to store computer programs; Processor: used to execute the computer program to implement the steps of the method for implementing high availability of an image repository based on the block protocol CSI as described in any one of claims 1-6.

Citation Information

Cited By

  • Container cloud deployment method, device and equipment based on DPC protocol

    CN120639772A