Method and equipment for creating CSI (Channel State Information) storage interface of container arrangement system
By creating a CSI storage interface in the container orchestration system, the problem of mixed and repeated mapping of storage credential information and user services in Guest K8s is solved, and the effect of improving the stability and security of the container orchestration system is achieved.
Patent Information
- Application Number
- CN202411824920.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-11
- Publication Date
- 2025-04-01
AI Technical Summary
In the prior art, Guest K8s uses existing Host Cinder CSI to access Cinder credential information and is mixed with user business, which has security risks. At the same time, when Guest K8s crashes or Kata virtual machine crashes, repeated mapping block devices lead to the problem of not being able to remount the original PV, resulting in poor stability and low security of the container orchestration system.
By creating a CSI storage interface in the container orchestration system, creating an association relationship between StorageClass and PVC in response to storage requests, calling the CreateVolume interface of the CSI storage interface to create a PV, and establishing an association relationship between the PV and the target Node node, controlling the CSI storage interface to store and manage the storage information based on these associations.
It realizes the stability and security of the container orchestration system, avoids the problems of mixed credential information and duplicate mapping, and ensures the security management of stored information and the normal operation of the container orchestration system.
Smart Images

Figure CN119739461A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of Internet technology, and in particular to a method and device for creating a CSI storage interface of a container orchestration system. Background Art
[0002] The container orchestration system is an open source platform for automated deployment, expansion, and operation and maintenance of container clusters. It has functions such as disaster recovery, horizontal expansion (elastic scaling), service discovery, load balancing, version rollback, and storage orchestration, and is widely used in the construction and management of computer clusters. For some business scenarios with high security requirements and certain requirements for pull-up speed, it cannot be achieved simply through virtual machines, so an agile version of the container orchestration system was created. The agile version of the container orchestration system refers to running the complete container orchestration system in a container, which in turn runs as a Pod on the outer container orchestration system. The container orchestration system running in the container is called Guest K8s, and the outer container orchestration system is called Host K8s. With the continuous expansion of the scale of containerized applications, storage management has become an important issue. Therefore, improving the storage capacity of the container orchestration system has become a promising direction.
[0003] In the current storage management method, PV is usually used to store container data. However, this method has some defects, such as the allocation and mounting process of storage volumes need to be manually managed, which increases the complexity and risk of operation. At the same time, since each container requires a separate storage volume, the utilization rate of storage space is low, and it is difficult to share and back up data. In order to solve these problems, some container orchestration systems have begun to introduce storage management functions, such as PV and PVC of container orchestration systems. These functions enable container orchestration systems to automatically allocate and manage storage volumes, simplify the operation process, and improve the utilization rate of storage space. With the continuous development and changes of cloud computing environments, traditional storage management methods can no longer meet new requirements. For example, cloud-native applications require more efficient storage management methods to improve resource utilization and performance. At the same time, some new storage technologies, such as distributed file systems and distributed caches, also need better support.
[0004] In order to solve these problems, some new container orchestration systems have begun to introduce more advanced storage management functions. Among them, using CSI storage is an important solution. CSI is a standard interface defined by the container orchestration system to expose any storage system to their container workloads. The OCI runtime used by the container where Geust K8s is located is kata, which provides an independent kernel and does not share the kernel with the host. The business in Guest K8s uses runc as the OCI runtime, that is, runcin kata mode. Kata, as an OCI runtime at the same level as runc, has an independent kernel. The business container process will run on this independent kernel. The environment is similar to that in a virtual machine, and therefore has higher security. In this way, the container orchestration environment required for the business can be quickly pulled up, as well as businesses with high security and isolation. OpenStack provides a variety of storage services, such as object storage, file sharing storage, and block storage. Among them, the volume with Cinder as the entrance can be connected to a variety of storage backends.
[0005] In the prior art, the credential information of the existing Host Cinder CSI used to access Cinder in Guest K8s is mixed with the user business, and the network of the user and Cinder can communicate with each other, which poses a security risk. At the same time, all information is stored in Guest K8s. If Guest K8s crashes or Kata virtual machine crashes, when the block device is mapped to the Kata virtual machine again, there will be a problem of repeated mapping, which will cause the problem of being unable to re-mount the original PV for the Guest K8s Pod. Therefore, the prior art has the technical problems of poor stability and low security of the container orchestration system. Summary of the invention
[0006] The present application provides a method and device for creating a CSI storage interface of a container orchestration system, which are used to solve the technical problems of poor temperature control effect, high energy consumption and poor adaptability in the prior art.
[0007] In a first aspect, the present application provides a method for creating a CSI storage interface of a container orchestration system, wherein the container orchestration system refers to a Guest K8s running in a target Pod node, the target Pod node runs in a Host K8s, and the Host K8s runs based on a target Node node, the method comprising:
[0008] In response to the storage request of the container orchestration system, create a storage class StorageClass corresponding to the CSI storage interface, and establish a first association relationship between StorageClass and the persistent volume application PVC, so that the PVC is mounted to the Pod directory corresponding to the container orchestration system;
[0009] Call the CreateVolume interface of the CSI storage interface to create a persistent volume PV and establish a second association relationship between the PV and the target Node node;
[0010] The CSI storage interface is controlled to store the information to be stored in the container orchestration system based on the first association relationship and the second association relationship.
[0011] Optionally, controlling the CSI storage interface to store the information to be stored in the container orchestration system based on the first association relationship and the second association relationship includes:
[0012] Based on the first association relationship, the controller of the CSI storage interface is controlled to publish a volume ControllerPublishVolume to generate a target block device at the target Node node;
[0013] Determine the Kata container corresponding to the container orchestration system based on the self-maintained mapping relationship, and hot-plug the virtual block device corresponding to the target block device into the Kata container;
[0014] Controlling the target Pod node corresponding to the container orchestration system to generate a virtual block device based on the second association relationship;
[0015] Update the volume attachment information corresponding to the PVC based on the block device information corresponding to the virtual block device.
[0016] Optionally, controlling the target Pod node corresponding to the container orchestration system to generate a virtual block device based on the second association relationship includes:
[0017] Based on the second association relationship, the CSI storage interface is called to run the target method, and the target Pod node corresponding to the container orchestration system is controlled to generate a corresponding virtual block device; the virtual block device is used to mount the target block device into the Pod directory.
[0018] Optionally, controlling the target Pod node corresponding to the container orchestration system to generate a virtual block device based on the second association relationship includes:
[0019] Based on the second association relationship, the CSI storage interface is called to run the first target method, and the virtual block device is formatted according to the volume attachment information and then mounted to a preset directory in the Kata container;
[0020] Based on the second association relationship, the CSI storage interface is called to run the second target method, and the preset directory is mounted to the Pod directory corresponding to the target Pod node, so that the target Pod node generates a corresponding virtual block device.
[0021] Optionally, after controlling the CSI storage interface to store the information to be stored in the container orchestration system based on the first association relationship and the second association relationship, the method includes:
[0022] In response to the Pod node destruction request of the container orchestration system, the Pod directory is uninstalled, and the node unstage volume interface NodeUnstageVolume of the CSI storage interface is called to uninstall the virtual block device in the Kata container;
[0023] Unplug the target block device from the Kata container and remove the target block device from the target Node.
[0024] Optionally, unmount the Pod directory and call the NodeUnstageVolume of the CSI storage interface to unmount the virtual block device in the Kata container, including:
[0025] Call the node unpublishing interface NodeUnpublishVolume based on the CSI storage interface to uninstall the Pod directory;
[0026] Call NodeUnstageVolume of the CSI storage interface to unmount the virtual block device in the preset directory of the Kata container.
[0027] Optionally, unplug the target block device from the Kata container and remove the target block device from the target Node, including:
[0028] Calling the target path unloading interface ControllerUnpublishVolume based on the CSI storage interface determines the target block device and the corresponding Carta container corresponding to the virtual block device according to the second association relationship;
[0029] Unplug the target block device from the Kata container and remove the target block device from the target Node.
[0030] In a second aspect of the present application, a CSI storage interface creation device of a container orchestration system is provided, including:
[0031] The first processing module, in response to a storage request of the container orchestration system, creates a StorageClass corresponding to the CSI storage interface, and establishes a first association relationship between the StorageClass and the PVC, so that the PVC is mounted to a Pod directory corresponding to the container orchestration system;
[0032] The second processing module calls CreateVolume of the CSI storage interface to create a PV and establish a second association relationship between the PV and the target Node node;
[0033] The third processing module controls the CSI storage interface to store the to-be-stored information of the container orchestration system based on the first association relationship and the second association relationship.
[0034] Optionally, the third processing module includes:
[0035] Based on the first association relationship, control the ControllerPublishVolume of the CSI storage interface to generate a target block device at the target Node node;
[0036] Determine the Kata container corresponding to the container orchestration system based on the self-maintained mapping relationship, and hot-plug the virtual block device corresponding to the target block device into the Kata container;
[0037] Controlling the target Pod node corresponding to the container orchestration system to generate a virtual block device based on the second association relationship;
[0038] Update the volume attachment information corresponding to the PVC based on the block device information corresponding to the virtual block device.
[0039] Optionally, the third processing module includes:
[0040] Based on the second association relationship, the CSI storage interface is called to run the target method, and the target Pod node corresponding to the container orchestration system is controlled to generate a corresponding virtual block device; the virtual block device is used to mount the target block device into the Pod directory.
[0041] Optionally, the third processing module includes:
[0042] Based on the second association relationship, the CSI storage interface is called to run the first target method, and the virtual block device is formatted according to the volume attachment information and then mounted to a preset directory in the Kata container;
[0043] Based on the second association relationship, the CSI storage interface is called to run the second target method, and the preset directory is mounted to the Pod directory corresponding to the target Pod node, so that the target Pod node generates a corresponding virtual block device.
[0044] Optionally, the third processing module includes:
[0045] In response to the Pod node destruction request of the container orchestration system, the Pod directory is uninstalled, and the NodeUnstageVolume of the CSI storage interface is called to uninstall the virtual block device in the Kata container;
[0046] Unplug the target block device from the Kata container and remove the target block device from the target Node.
[0047] Optionally, the third processing module includes:
[0048] Call NodeUnpublishVolume based on the CSI storage interface to unload the Pod directory;
[0049] Call NodeUnstageVolume of the CSI storage interface to unmount the virtual block device in the preset directory of the Kata container.
[0050] Optionally, the third processing module includes:
[0051] Calling ControllerUnpublishVolume based on the CSI storage interface determines the target block device and the corresponding Carta container corresponding to the virtual block device according to the second association relationship;
[0052] Unplug the target block device from the Kata container and remove the target block device from the target Node.
[0053] In a third aspect, the present application provides a CSI storage interface creation device for a container orchestration system, including: a processor, and a memory connected to the processor in communication, including:
[0054] Memory stores computer-executable instructions;
[0055] The processor executes the computer execution instructions stored in the memory to implement the CSI storage interface creation method of the container orchestration system of the first aspect.
[0056] In a fourth aspect, a computer-readable storage medium stores computer-executable instructions, which, when executed by a processor, are used to implement the CSI storage interface creation method of the container orchestration system of the first aspect.
[0057] The present application provides a method and device for creating a CSI storage interface of a container orchestration system, wherein the container orchestration system refers to a Guest K8s running in a target Pod node, and the target Pod node runs in a Host K8s. K8s runs based on the target Node node, responds to the storage request of the container orchestration system, creates the StorageClass corresponding to the CSI storage interface, and establishes the first association relationship between StorageClass and PVC, so that the PVC is mounted to the Pod directory corresponding to the container orchestration system; calls CreateVolume of the CSI storage interface to create PV, and establishes the second association relationship between PV and the target Node node; controls the CSI storage interface to store the information to be stored of the container orchestration system based on the first association relationship and the second association relationship, and then responds to the storage request of the container orchestration system, creates the StorageClass corresponding to the CSI storage interface, and establishes the first association relationship between StorageClass and PVC, so that the PVC is mounted to the Pod directory corresponding to the container orchestration system; calls CreateVolume of the CSI storage interface to create PV, and establishes the second association relationship between PV and the target Node node; based on the first association relationship, controls ControllerPublishVolume of the CSI storage interface to generate a target block device at the target Node node; determines the container orchestration system corresponding to the card based on the self-maintained mapping relationship The method comprises the steps of: hot plugging a virtual block device corresponding to a target block device into a Kata container; calling a CSI storage interface based on a second association relationship to run a first target method, formatting the virtual block device according to the volume attachment information and mounting it to a preset directory in the Kata container; calling a CSI storage interface based on a second association relationship to run a second target method, mounting the preset directory to a Pod directory corresponding to a target Pod node, so that the target Pod node generates a corresponding virtual block device; updating the volume attachment information corresponding to the PVC based on the block device information corresponding to the virtual block device; responding to a Pod node destruction request of a container orchestration system, unmounting the Pod directory, and calling NodeUnpublishVolume based on a CSI storage interface to unmount the Pod directory; calling NodeUnstageVolume of a CSI storage interface to unmount the virtual block device in the preset directory of the Kata container; calling ControllerUnpublishVolume based on a CSI storage interface to determine a target block device and a corresponding Kata container corresponding to the virtual block device according to the second association relationship; unplugging the target block device from the Kata container, and removing the target block device from the target Node node, thereby achieving a technical effect of improving the stability of the container orchestration system. BRIEF DESCRIPTION OF THE DRAWINGS
[0058] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present application and, together with the description, serve to explain the principles of the present application.
[0059] Figure 1 The process of the CSI storage interface creation method of the container orchestration system provided in the embodiment of the present application Figure 1 ;
[0060] Figure 2 The process of the CSI storage interface creation method of the container orchestration system provided in the embodiment of the present application Figure 2 ;
[0061] Figure 3 The process of the CSI storage interface creation method of the container orchestration system provided in the embodiment of the present application Figure 3 ;
[0062] Figure 4 A schematic diagram of a method for creating a CSI storage interface for a container orchestration system provided in an embodiment of the present application;
[0063] Figure 5 A schematic diagram of the structure of a CSI storage interface creation device for a container orchestration system provided in an embodiment of the present application;
[0064] Figure 6 A hardware schematic diagram of a CSI storage interface creation device for a container orchestration system provided in an embodiment of the present application.
[0065] The above drawings have shown clear embodiments of the present application, which will be described in more detail later. These drawings and text descriptions are not intended to limit the scope of the present application in any way, but to illustrate the concept of the present application to those skilled in the art by referring to specific embodiments. DETAILED DESCRIPTION
[0066] Exemplary embodiments will be described in detail herein, examples of which are shown in the accompanying drawings. When the following description refers to the drawings, the same numbers in different drawings represent the same or similar elements unless otherwise indicated. The implementations described in the following exemplary embodiments do not represent all implementations consistent with the present application. Instead, they are merely examples of devices and methods consistent with some aspects of the present application as detailed in the appended claims.
[0067] First, the terms involved in this application are explained:
[0068] Container Storage Interface (CSI) is a standard interface defined by container orchestration systems.
[0069] The container orchestration system (Kubernetes, K8s for short) provides networking and storage to provide a full range of services for the businesses in the Pod, allowing the business side to focus on business implementation.
[0070] Storage Class: By creating a StorageClass, you can dynamically generate a storage volume for k8s users to use. You can dynamically create appropriate PV resources based on the needs of PVC, thereby realizing on-demand creation of storage volumes.
[0071] A persistent volume claim (PVC) is an application for storage resources by a Pod, which mainly includes storage space application and access mode.
[0072] A persistent volume (PV) is a piece of storage in a cluster that can be prepared in advance by an administrator or dynamically prepared using a storage class.
[0073] Create a volume interface (CreateVolume), which can create a storage volume.
[0074] ControllerPublishVolume mounts a created storage volume to the specified node.
[0075] The self-maintained mapping relationship (QEMU Machine Protocol, referred to as QMP) is the qemu virtual machine protocol, which is a part of qemu. qmp is a set of protocols based on the json format. Through this set of protocols, we can control the entire life cycle of the qemu virtual machine instance.
[0076] Kata Container is a lightweight virtualization technology that combines the advantages of container and virtual machine technologies to achieve high isolation, security, and performance.
[0077] Node stage interface (NodeStageVolume), CO calls this method to temporarily mount a volume to the stage path.
[0078] NodeUnstageVolume interface, CO calls this method to unmount the volume from the staging path.
[0079] NodeUnpublishVolume interface is used to unmount the volume from the target path.
[0080] The target path unmount interface (ControllerUnpublishVolume) makes the volume unavailable on the specified node.
[0081] In the prior art, the credential information of the existing Host Cinder CSI used to access Cinder in Guest K8s is mixed with the user business, and the user and Cinder networks can communicate with each other, which poses a security risk. At the same time, all information is stored in Guest K8s. If Guest K8s crashes or Kata virtual machines crash, when the block device is mapped to the Kata virtual machine again, there will be a problem of repeated mapping, which will cause the original PV to be unable to be remounted for the Guest K8s Pod. Therefore, the prior art has the technical problems of poor stability and low security of the container orchestration system.
[0082] The present application provides a method for creating a CSI storage interface of a container orchestration system, wherein the container orchestration system refers to Guest K8s running in a target Pod node, the target Pod node runs in Host K8s, and the Host K8s runs based on the target Node node, responds to the storage request of the container orchestration system, creates the StorageClass corresponding to the CSI storage interface, and establishes the first association relationship between StorageClass and PVC, so that the PVC is mounted to the Pod directory corresponding to the container orchestration system; calls CreateVolume of the CSI storage interface to create PV, and establishes the second association relationship between PV and the target Node node; controls the CSI storage interface to store the information to be stored of the container orchestration system based on the first association relationship and the second association relationship, and then responds to the storage request of the container orchestration system, creates the StorageClass corresponding to the CSI storage interface, and establishes the first association relationship between StorageClass and PVC, so that the PVC is mounted to the Pod directory corresponding to the container orchestration system; calls CreateVolume of the CSI storage interface to create PV, and establishes the second association relationship between PV and the target Node node; based on the first association relationship, controls ControllerPublishVolume of the CSI storage interface to generate a target block device at the target Node node; determines the container orchestration system corresponding to the card based on the self-maintained mapping relationship The method comprises the steps of: hot plugging a virtual block device corresponding to a target block device into a Kata container; calling a CSI storage interface based on a second association relationship to run a first target method, formatting the virtual block device according to the volume attachment information and mounting it to a preset directory in the Kata container; calling a CSI storage interface based on a second association relationship to run a second target method, mounting the preset directory to a Pod directory corresponding to a target Pod node, so that the target Pod node generates a corresponding virtual block device; updating the volume attachment information corresponding to the PVC based on the block device information corresponding to the virtual block device; responding to a Pod node destruction request of a container orchestration system, unmounting the Pod directory, and calling NodeUnpublishVolume based on a CSI storage interface to unmount the Pod directory; calling NodeUnstageVolume of a CSI storage interface to unmount the virtual block device in the preset directory of the Kata container; calling ControllerUnpublishVolume based on a CSI storage interface to determine a target block device and a corresponding Kata container corresponding to the virtual block device according to the second association relationship; unplugging the target block device from the Kata container, and removing the target block device from the target Node node, thereby achieving a technical effect of improving the stability of the container orchestration system.
[0083] The technical solution of the present application and how the technical solution of the present application solves the above-mentioned technical problems are described in detail below with specific embodiments. The following 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 the present application will be described below in conjunction with the accompanying drawings.
[0084] Figure 1 The CSI storage interface creation method process of the container orchestration system provided in the embodiment of the present application Figure 1 .like Figure 1 As shown, the CSI storage interface creation method of the container orchestration system provided in this embodiment, the container orchestration system refers to the Guest K8s running in the target Pod node, the target Pod node runs in the Host K8s, and the Host K8s runs based on the target Node node and includes:
[0085] S101. In response to a storage request from the container orchestration system, create a StorageClass corresponding to the CSI storage interface, and establish a first association relationship between the StorageClass and the PVC, so that the PVC is mounted to the Pod directory corresponding to the container orchestration system;
[0086] S102, calling CreateVolume of the CSI storage interface to create a PV, and establishing a second association relationship between the PV and the target Node;
[0087] In this embodiment, CSI will request the service running on Host K8s in the implementation of the CreateVolume interface. This service is responsible for connecting with Cinder. Therefore, CSI does not need to know the relevant access methods and credentials of Cinder.
[0088] S103: Control the CSI storage interface to store the information to be stored in the container orchestration system based on the first association relationship and the second association relationship.
[0089] The present application provides a method for creating a CSI storage interface of a container orchestration system, wherein the container orchestration system refers to Guest K8s running in a target Pod node, the target Pod node runs in Host K8s, and the Host K8s runs based on the target Node node, responds to the storage request of the container orchestration system, creates the StorageClass corresponding to the CSI storage interface, and establishes the first association relationship between StorageClass and PVC, so that the PVC is mounted to the Pod directory corresponding to the container orchestration system; calls CreateVolume of the CSI storage interface to create PV, and establishes the second association relationship between PV and the target Node node; controls the CSI storage interface to store the information to be stored of the container orchestration system based on the first association relationship and the second association relationship, and then responds to the storage request of the container orchestration system, creates the StorageClass corresponding to the CSI storage interface, and establishes the first association relationship between StorageClass and PVC, so that the PVC is mounted to the Pod directory corresponding to the container orchestration system; calls CreateVolume of the CSI storage interface to create PV, and establishes the second association relationship between PV and the target Node node; based on the first association relationship, controls ControllerPublishVolume of the CSI storage interface to generate a target block device at the target Node node; determines the container orchestration system corresponding to the card based on the self-maintained mapping relationship The method comprises the steps of: hot plugging a virtual block device corresponding to a target block device into a Kata container; calling a CSI storage interface based on a second association relationship to run a first target method, formatting the virtual block device according to the volume attachment information and mounting it to a preset directory in the Kata container; calling a CSI storage interface based on a second association relationship to run a second target method, mounting the preset directory to a Pod directory corresponding to a target Pod node, so that the target Pod node generates a corresponding virtual block device; updating the volume attachment information corresponding to the PVC based on the block device information corresponding to the virtual block device; responding to a Pod node destruction request of a container orchestration system, unmounting the Pod directory, and calling NodeUnpublishVolume based on a CSI storage interface to unmount the Pod directory; calling NodeUnstageVolume of a CSI storage interface to unmount the virtual block device in the preset directory of the Kata container; calling ControllerUnpublishVolume based on a CSI storage interface to determine a target block device and a corresponding Kata container corresponding to the virtual block device according to the second association relationship; unplugging the target block device from the Kata container, and removing the target block device from the target Node node, thereby achieving a technical effect of improving the stability of the container orchestration system.
[0090] Figure 2 The CSI storage interface creation method process of the container orchestration system provided in the embodiment of the present application Figure 2.like Figure 2 As shown, the CSI storage interface creation method of the container orchestration system provided in this embodiment includes:
[0091] S201. In response to a storage request from the container orchestration system, create a StorageClass corresponding to the CSI storage interface, and establish a first association relationship between the StorageClass and the PVC, so that the PVC is mounted to the Pod directory corresponding to the container orchestration system;
[0092] S202, calling CreateVolume of the CSI storage interface to create a PV, and establishing a second association relationship between the PV and the target Node;
[0093] S203, based on the first association relationship, control the ControllerPublishVolume of the CSI storage interface to generate a target block device at the target Node node; determine the Kata container corresponding to the container orchestration system based on the self-maintained mapping relationship, and hot-plug the virtual block device corresponding to the target block device into the Kata container;
[0094] In this embodiment, the mapping relationship QEMU Machine Protocol includes suspension, pause, snapshot, query and hot plug of peripherals; Kata container includes runtime, agent and image; the runtime of Kata container is built based on Intel's virtualization technology, which is to avoid the need to change the kernel when embedding the system, and it is easier to integrate with Kubernetes; the agent of Kata container is part of Kubernetes Pod, which is the interface between the container and the runtime. The agent forwards the container's request to the corresponding runtime, and the execution details are handled by the runtime; Kata container can use Docker image.
[0095] S204, based on the second association relationship, calling the CSI storage interface to run the first target method, formatting the virtual block device according to the volume attachment information and mounting it to the preset directory in the Kata container; based on the second association relationship, calling the CSI storage interface to run the second target method, mounting the preset directory to the Pod directory corresponding to the target Pod node, so that the target Pod node generates a corresponding virtual block device; based on the block device information corresponding to the virtual block device, updating the volume attachment information corresponding to the PVC;
[0096] In this embodiment, the CSI storage interface runs the node temporary storage interface NodeStageVolume, and the node temporary storage interface NodeStageVolume formats the virtual block device according to the volume attachment information and mounts it to the preset directory in the Kata container; the CSI storage interface runs NodeUnpublishVolume, and NodeUnpublishVolume mounts the preset directory to the Pod directory corresponding to the target Pod node in bind mode; the volume attachment information is the status of VolumeAttachment.
[0097] S205. In response to the Pod node destruction request of the container orchestration system, the Pod directory is unloaded, and NodeUnpublishVolume is called based on the CSI storage interface to unload the Pod directory; NodeUnstageVolume of the CSI storage interface is called to unload the virtual block device in the preset directory of the Carta container;
[0098] In this embodiment, the CSI storage interface calls NodeUnpublishVolume to unload the Pod directory.
[0099] S206. Call ControllerUnpublishVolume based on the CSI storage interface to determine the target block device and the corresponding Carta container corresponding to the virtual block device according to the second association relationship; unplug the target block device from the Carta container, and remove the target block device from the target Node.
[0100] In this embodiment, Guest K8s calls ControllerUnpublishVolume based on the CSI storage interface, determines the target block device and the corresponding Cata container corresponding to the virtual block device according to the second association relationship; unplugs the target block device from the Cata container, and removes the target block device from the target Node node.
[0101] In a possible implementation, in response to a PV deletion request from the container orchestration system, the CSI storage interface calls DeleteVolume to delete the PV according to the second association relationship, and deletes the target Node node corresponding to the PV of Host K8s according to the second association relationship.
[0102] In one possible implementation, in response to the PV expansion request from the container orchestration system, expansion is performed on both the CSI and Host K8s.
[0103] Figure 3 The CSI storage interface creation method process of the container orchestration system provided in the embodiment of the present application Figure 3 .like Figure 3As shown, the CSI storage interface creation method of the container orchestration system provided in this embodiment includes:
[0104] S301, Provisioner monitors the creation of PVC and calls the CSI storage interface to initiate a request to create a PV;
[0105] S302, the CSI storage interface calls the storage operation StorageOperator to create a volume Volume;
[0106] In this embodiment, the storage operation StorageOperator includes three functions, namely, inserting, unplugging and expanding the device. These three functions are implemented based on a self-maintained mapping relationship (QEMU Machine Protocol, referred to as QMP). To use this method, you need to first find the corresponding QMP Socket from the Kata container, that is, the way to communicate with the Kata container. After finding the path of this socket file, you can splice different interactive commands according to the function. For example, for insertion, first map the block device rbd to the local, and then splice the insertion command. After execution, enter the corresponding Kata container and you can see the corresponding virtual block device.
[0107] S303, Guest K8s calls the CSI storage interface to update the Attach operation. The CSI storage interface calls the storage operation StorageOperator to create a target block device on the host and transparently transmit it to the Kata container;
[0108] In this embodiment, the host machine is the Host K8s running on the target Pod node.
[0109] S304, Guest K8s calls the CSI storage interface to mount the target block device to the preset directory of the Kata container;
[0110] S305, Guest K8s calls the CSI storage interface to mount the preset directory directly to the Pod's directory;
[0111] S306. Guest K8s calls the CSI storage interface to uninstall the preset directory from the Pod directory.
[0112] S307, Guest K8s calls the CSI storage interface to uninstall the target block device from the preset directory;
[0113] S308, Guest K8s calls the CSI storage interface to perform the Detach operation. The CSI storage interface calls the storage operation StorageOperator on the host to remove the virtual device from the Kata container and delete the virtual block device.
[0114] S309. Guest K8s determines whether to delete the PV and whether to call the storage operation StorageOperator to delete the volume Volume through the CSI storage interface based on the configuration in StorageClass.
[0115] Figure 4 This is a flowchart of a first exemplary method for creating a CSI storage interface for a container orchestration system provided in an embodiment of the present application. Figure 4 As shown in the first example, the CSI storage interface provides Cinder storage for Guest K8s, the container orchestration system is Guest K8s running in the target Pod node, the target Pod node runs in Host K8s, and the Host K8s runs based on the target Node node, and the CSI storage interface is connected to the Cinder storage. In response to the storage request of the container orchestration system, a StorageClass corresponding to the CSI storage interface is created, and a first association relationship between the StorageClass and the PVC is established so that the PVC is mounted to the Pod directory corresponding to the container orchestration system; the CreateVolume of the CSI storage interface is called to create a PV, and a second association relationship between the PV and the target Node node is established; based on the first association relationship, the ControllerPublishVolume of the CSI storage interface is controlled to generate a target block device at the target Node node; based on the self-maintained mapping relationship, the Kata container corresponding to the container orchestration system is determined, and the virtual block device corresponding to the target block device is hot-plugged into the Kata container; based on the second association relationship, the CSI storage interface is called to run the first target method, and the virtual block device is formatted according to the volume attachment information and mounted to the preset directory in the Kata container; based on the second association relationship, the CSI storage interface is called to run the second target method, and the preset directory is mounted to the Pod directory corresponding to the target Pod node, so that the target Pod node generates the corresponding virtual block device; based on the block device information corresponding to the virtual block device, the volume attachment information corresponding to the PVC is updated. The CSI storage interface includes two stages: attach and mount. The CSIController service calls the storage operation proxy StorageOperatorProxy. The storage operation proxy StorageOperatorProxy calls the corresponding service according to the physical machine where the target Pod node is located, that is, calls the storage operation handler StorageOperatorHandler. The storage operation handler StorageOperatorHandler maps the volume to the container orchestration system; and transparently transmits the rbd device to the target Pod node.
[0116] The present application provides a method for creating a CSI storage interface of a container orchestration system, wherein the container orchestration system refers to Guest K8s running in a target Pod node, the target Pod node runs in Host K8s, and the Host K8s runs based on the target Node node, responds to the storage request of the container orchestration system, creates the StorageClass corresponding to the CSI storage interface, and establishes the first association relationship between StorageClass and PVC, so that the PVC is mounted to the Pod directory corresponding to the container orchestration system; calls CreateVolume of the CSI storage interface to create PV, and establishes the second association relationship between PV and the target Node node; controls the CSI storage interface to store the information to be stored of the container orchestration system based on the first association relationship and the second association relationship, and then responds to the storage request of the container orchestration system, creates the StorageClass corresponding to the CSI storage interface, and establishes the first association relationship between StorageClass and PVC, so that the PVC is mounted to the Pod directory corresponding to the container orchestration system; calls CreateVolume of the CSI storage interface to create PV, and establishes the second association relationship between PV and the target Node node; based on the first association relationship, controls ControllerPublishVolume of the CSI storage interface to generate a target block device at the target Node node; determines the container orchestration system corresponding to the card based on the self-maintained mapping relationship The method comprises the steps of: hot plugging a virtual block device corresponding to a target block device into a Kata container; calling a CSI storage interface based on a second association relationship to run a first target method, formatting the virtual block device according to the volume attachment information and mounting it to a preset directory in the Kata container; calling a CSI storage interface based on a second association relationship to run a second target method, mounting the preset directory to a Pod directory corresponding to a target Pod node, so that the target Pod node generates a corresponding virtual block device; updating the volume attachment information corresponding to the PVC based on the block device information corresponding to the virtual block device; responding to a Pod node destruction request of a container orchestration system, unmounting the Pod directory, and calling NodeUnpublishVolume based on a CSI storage interface to unmount the Pod directory; calling NodeUnstageVolume of a CSI storage interface to unmount the virtual block device in the preset directory of the Kata container; calling ControllerUnpublishVolume based on a CSI storage interface to determine a target block device and a corresponding Kata container corresponding to the virtual block device according to the second association relationship; unplugging the target block device from the Kata container, and removing the target block device from the target Node node, thereby achieving a technical effect of improving the stability of the container orchestration system.
[0117] Figure 5 A schematic diagram of a CSI storage interface creation device for a container orchestration system provided in an embodiment of the present application Figure 1 .like Figure 5 As shown, a CSI storage interface creation device 500 of a container orchestration system provided in an embodiment of the present application includes: a first processing module 501, a second processing module 502 and a third processing module 503;
[0118] The first processing module 501, in response to a storage request of the container orchestration system, creates a StorageClass corresponding to the CSI storage interface, and establishes a first association relationship between the StorageClass and the PVC, so that the PVC is mounted to a Pod directory corresponding to the container orchestration system;
[0119] The second processing module 502 calls CreateVolume of the CSI storage interface to create a PV and establish a second association relationship between the PV and the target Node;
[0120] The third processing module 503 controls the CSI storage interface to store the to-be-stored information of the container orchestration system based on the first association relationship and the second association relationship.
[0121] In a possible implementation, the third processing module 503 includes:
[0122] Based on the first association relationship, control the ControllerPublishVolume of the CSI storage interface to generate a target block device at the target Node node;
[0123] Determine the Kata container corresponding to the container orchestration system based on the self-maintained mapping relationship, and hot-plug the virtual block device corresponding to the target block device into the Kata container;
[0124] Controlling the target Pod node corresponding to the container orchestration system to generate a virtual block device based on the second association relationship;
[0125] Update the volume attachment information corresponding to the PVC based on the block device information corresponding to the virtual block device.
[0126] In a possible implementation, the third processing module 503 includes:
[0127] Based on the second association relationship, the CSI storage interface is called to run the target method, and the target Pod node corresponding to the container orchestration system is controlled to generate a corresponding virtual block device; the virtual block device is used to mount the target block device into the Pod directory.
[0128] In a possible implementation, the third processing module 503 includes:
[0129] Based on the second association relationship, the CSI storage interface is called to run the first target method, and the virtual block device is formatted according to the volume attachment information and then mounted to a preset directory in the Kata container;
[0130] Based on the second association relationship, the CSI storage interface is called to run the second target method, and the preset directory is mounted to the Pod directory corresponding to the target Pod node, so that the target Pod node generates a corresponding virtual block device.
[0131] In a possible implementation, the third processing module 503 includes:
[0132] In response to the Pod node destruction request of the container orchestration system, the Pod directory is uninstalled, and the NodeUnstageVolume of the CSI storage interface is called to uninstall the virtual block device in the Kata container;
[0133] Unplug the target block device from the Kata container and remove the target block device from the target Node.
[0134] In a possible implementation, the third processing module 503 includes:
[0135] Call NodeUnpublishVolume based on the CSI storage interface to unload the Pod directory;
[0136] Call NodeUnstageVolume of the CSI storage interface to unmount the virtual block device in the preset directory of the Kata container.
[0137] In a possible implementation, the third processing module 503 includes:
[0138] Calling ControllerUnpublishVolume based on the CSI storage interface determines the target block device and the corresponding Carta container corresponding to the virtual block device according to the second association relationship;
[0139] Unplug the target block device from the Kata container and remove the target block device from the target Node.
[0140] The present application provides a CSI storage interface creation device for a container orchestration system, wherein the container orchestration system refers to Guest K8s running in a target Pod node, and the target Pod node runs in Host K8s. K8s runs based on the target Node node, responds to the storage request of the container orchestration system, creates the StorageClass corresponding to the CSI storage interface, and establishes the first association relationship between StorageClass and PVC, so that the PVC is mounted to the Pod directory corresponding to the container orchestration system; calls CreateVolume of the CSI storage interface to create PV, and establishes the second association relationship between PV and the target Node node; controls the CSI storage interface to store the information to be stored of the container orchestration system based on the first association relationship and the second association relationship, and then responds to the storage request of the container orchestration system, creates the StorageClass corresponding to the CSI storage interface, and establishes the first association relationship between StorageClass and PVC, so that the PVC is mounted to the Pod directory corresponding to the container orchestration system; calls CreateVolume of the CSI storage interface to create PV, and establishes the second association relationship between PV and the target Node node; based on the first association relationship, controls ControllerPublishVolume of the CSI storage interface to generate a target block device at the target Node node; determines the container orchestration system corresponding to the card based on the self-maintained mapping relationship The method comprises the steps of: hot plugging a virtual block device corresponding to a target block device into a Kata container; calling a CSI storage interface based on a second association relationship to run a first target method, formatting the virtual block device according to the volume attachment information and mounting it to a preset directory in the Kata container; calling a CSI storage interface based on a second association relationship to run a second target method, mounting the preset directory to a Pod directory corresponding to a target Pod node, so that the target Pod node generates a corresponding virtual block device; updating the volume attachment information corresponding to the PVC based on the block device information corresponding to the virtual block device; responding to a Pod node destruction request of a container orchestration system, unmounting the Pod directory, and calling NodeUnpublishVolume based on a CSI storage interface to unmount the Pod directory; calling NodeUnstageVolume of a CSI storage interface to unmount the virtual block device in the preset directory of the Kata container; calling ControllerUnpublishVolume based on a CSI storage interface to determine a target block device and a corresponding Kata container corresponding to the virtual block device according to the second association relationship; unplugging the target block device from the Kata container, and removing the target block device from the target Node node, thereby achieving a technical effect of improving the stability of the container orchestration system.
[0141] Figure 6 The hardware structure diagram of the CSI storage interface creation device of the container orchestration system provided in the embodiment of the present application. Figure 6 As shown, the CSI storage interface creation device 600 of the container orchestration system includes:
[0142] A processor 601, and a memory 602 communicatively connected to the processor;
[0143] Memory stores computer-executable instructions;
[0144] The processor executes the computer-executable instructions stored in the memory 602, so that the CSI storage interface creation device of the container orchestration system executes the CSI storage interface creation method of the container orchestration system as described above.
[0145] It should be understood that the processor 601 may be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSP), or application-specific integrated circuits (ASIC). A general-purpose processor may be a microprocessor or any conventional processor. The steps of the method disclosed in the invention may be directly implemented as being executed by a hardware processor, or may be implemented by a combination of hardware and software modules in the processor. The memory 602 may include a high-speed random access memory (RAM), and may also include a non-volatile memory (NVM), such as at least one disk memory, and may also be a USB flash drive, a mobile hard disk, a read-only memory, a disk, or an optical disk.
[0146] The embodiment of the present application also provides a computer-readable storage medium, in which computer-executable instructions are stored. When the computer-executable instructions are executed by a processor, they are used to implement the CSI storage interface creation method of the container orchestration system as described above.
[0147] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data must comply with relevant laws, regulations and standards, and provide corresponding operation entrances for users to choose to authorize or refuse.
[0148] It should be noted that, for the aforementioned method embodiments, for the sake of simplicity, they are all expressed as a series of action combinations, but those skilled in the art should be aware that the present application is not limited by the described order of actions, because according to the present application, certain steps can be performed in other orders or simultaneously. Secondly, those skilled in the art should also be aware that the embodiments described in the specification are all optional embodiments, and the actions and modules involved are not necessarily required by the present application.
[0149] It should be further noted that, although the various steps in the flowchart are displayed in sequence according to the indication of the arrows, these steps are not necessarily executed in sequence in the order indicated by the arrows. Unless there is a clear description in this article, the execution of these steps is not strictly limited in order, and these steps can be executed in other orders. Moreover, at least a portion of the steps in the flowchart may include multiple sub-steps or multiple stages, and these sub-steps or stages are not necessarily executed at the same time, but can be executed at different times, and the execution order of these sub-steps or stages is not necessarily to be carried out in sequence, but can be executed in turn or alternately with other steps or at least a portion of the sub-steps or stages of other steps.
[0150] It should be understood that the above device embodiments are only illustrative, and the device of the present application can also be implemented in other ways. For example, the division of units / modules in the above embodiments is only a logical function division, and there may be other division methods in actual implementation. For example, multiple units, modules or components can be combined, or can be integrated into another system, or some features can be ignored or not executed.
[0151] In addition, unless otherwise specified, each functional unit / module in each embodiment of the present application may be integrated into one unit / module, each unit / module may exist physically separately, or two or more units / modules may be integrated together. The above-mentioned integrated unit / module may be implemented in the form of hardware or in the form of a software program module.
[0152] If the integrated unit / module is implemented in the form of hardware, the hardware may be a digital circuit, an analog circuit, etc. The physical implementation of the hardware structure includes but is not limited to transistors, memristors, etc. Unless otherwise specified, the processor may be any appropriate hardware processor, such as a CPU, a GPU, an FPGA, a DSP, an ASIC, etc. Unless otherwise specified, the storage unit may be any appropriate magnetic storage medium or magneto-optical storage medium, such as a resistive random access memory (RRAM), a dynamic random access memory (DRAM), a static random access memory (SRAM), an enhanced dynamic random access memory (EDRAM), a high-bandwidth memory (HBM), a hybrid memory cube (HMC), etc.
[0153] If the integrated unit / module is implemented in the form of a software program module and sold or used as an independent product, it can be stored in a computer-readable memory. Based on this understanding, the technical solution of the present application, or the part that contributes to the prior art, or all or part of the technical solution can be embodied in the form of a software product. The computer software product is stored in a memory, including a number of instructions to enable a computer device (which can be a personal computer, server or network device, etc.) to execute all or part of the steps of the various embodiments of the present application. The aforementioned memory includes: U disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), mobile hard disk, disk or optical disk and other media that can store program codes.
[0154] In the above embodiments, the description of each embodiment has its own emphasis. For the part not described in detail in a certain embodiment, please refer to the relevant description of other embodiments. The technical features of the above embodiments can be combined arbitrarily. In order to make the description concise, all possible combinations of the technical features in the above embodiments are not described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0155] Those skilled in the art will readily appreciate other embodiments of the present application after considering the specification and practicing the invention disclosed herein. The present application is intended to cover any variations, uses or adaptations of the present application, which follow the general principles of the present application and include common knowledge or customary techniques in the art that are not disclosed in the present application. The specification and examples are intended to be exemplary only, and the true scope and spirit of the present application are indicated by the following claims.
[0156] It should be understood that the present application is not limited to the precise structures that have been described above and shown in the drawings, and that various modifications and changes may be made without departing from the scope thereof. The scope of the present application is limited only by the appended claims.
Claims
1. A method for creating a CSI storage interface of a container orchestration system, characterized in that: The container orchestration system refers to the Guest K8s running in the target Pod node, the target Pod node runs in the Host K8s, and the Host K8s runs based on the target Node node. The method includes: In response to a storage request from the container orchestration system, create a storage class corresponding to the CSI storage interface, and establish a first association relationship between the storage class and a persistent volume application PVC, so that the persistent volume application is mounted to a Pod directory corresponding to the container orchestration system; Calling the create volume interface of the CSI storage interface to create a persistent volume PV, and establishing a second association relationship between the persistent volume and the target Node node; The CSI storage interface is controlled to store the information to be stored in the container orchestration system based on the first association relationship and the second association relationship.
2. The method according to claim 1, characterized in that The controlling the CSI storage interface to store the information to be stored in the container orchestration system based on the first association relationship and the second association relationship includes: Based on the first association relationship, the controller of the CSI storage interface is controlled to publish a volume to generate a target block device at the target Node node; Determine a Kata container corresponding to the container orchestration system based on a self-maintained mapping relationship, and hot-plug a virtual block device corresponding to the target block device into the Kata container; Based on the second association relationship, control the target Pod node corresponding to the container orchestration system to generate the virtual block device; The volume attachment information corresponding to the persistent volume application is updated based on the block device information corresponding to the virtual block device.
3. The method according to claim 2, characterized in that The controlling the target Pod node corresponding to the container orchestration system to generate the virtual block device based on the second association relationship includes: The CSI storage interface is called to run the target method based on the second association relationship, and the target Pod node corresponding to the container orchestration system is controlled to generate the corresponding virtual block device; the virtual block device is used to mount the target block device into the Pod directory.
4. The method according to claim 3, characterized in that: The controlling the target Pod node corresponding to the container orchestration system to generate the virtual block device based on the second association relationship includes: Based on the second association relationship, the CSI storage interface is called to run the first target method, and the virtual block device is formatted according to the volume attachment information and then mounted to a preset directory in the Kata container; Based on the second association relationship, the CSI storage interface is called to run a second target method, and the preset directory is mounted to the Pod directory corresponding to the target Pod node, so that the target Pod node generates the corresponding virtual block device.
5. The method according to claim 4, characterized in that After controlling the CSI storage interface to store the information to be stored in the container orchestration system based on the first association relationship and the second association relationship, the method includes: In response to a Pod node destruction request of the container orchestration system, the Pod directory is uninstalled, and the node non-temporary storage interface of the CSI storage interface is called to uninstall the virtual block device in the Kata container; Unplug the target block device from the Kata container, and remove the target block device from the target Node.
6. The method according to claim 5, characterized in that The step of uninstalling the Pod directory and calling the node non-temporary storage interface of the CSI storage interface to load the virtual block device in the Kata container includes: Uninstall the Pod directory based on the CSI storage interface calling node to cancel the publishing interface; The node non-temporary storage interface of the CSI storage interface is called to uninstall the virtual block device in the preset directory of the kata container.
7. The method according to claim 6, characterized in that The step of pulling out the target block device from the Kata container and removing the target block device from the target Node node includes: Calling a target path offload interface based on the CSI storage interface determines the target block device and the corresponding Carta container corresponding to the virtual block device according to the second association relationship; Unplug the target block device from the Kata container, and remove the target block device from the target Node.
8. A CSI storage interface creation device for a container orchestration system, characterized in that: include: The first processing module, in response to the storage request of the container orchestration system, creates a storage class corresponding to the CSI storage interface, and establishes a first association relationship between the storage class and the persistent volume application, so that the persistent volume application is mounted to the Pod directory corresponding to the container orchestration system; The second processing module calls the create volume interface of the CSI storage interface to create a persistent volume, and establishes a second association relationship between the persistent volume and the target Node node; The third processing module controls the CSI storage interface to store the to-be-stored information of the container orchestration system based on the first association relationship and the second association relationship.
9. A CSI storage interface creation device for a container orchestration system, characterized in that: include: A processor, and a memory communicatively connected to the processor; The memory stores computer-executable instructions; The processor executes the computer-executable instructions stored in the memory to implement the CSI storage interface creation method of the container orchestration system according to any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer-executable instructions, which, when executed by a processor, are used to implement the CSI storage interface creation method for a container orchestration system according to any one of claims 1 to 7.