A method and system for implementing migration of FlexVolume type storage to CSI storage

By adding migration parameters in Kubernetes and packaging the FlexVolume plug-in as an in-tree plug-in, the migration from FlexVolume to CSI is realized, which solves the problems of cluster environment complexity and FlexVolume deprecation, and achieves efficient storage migration and improved deployment efficiency.

CN114546533BActive Publication Date: 2024-09-24SHANDONG LANGCHAO YUNTOU INFORMATION TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202210186615.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-02-28
Publication Date
2024-09-24
Estimated Expiration
2042-02-28

AI Technical Summary

Technical Problem

When existing Kubernetes clusters use FlexVolume type storage, the cluster environment is complex and cumbersome, especially when multiple storage types are used at the same time, and FlexVolume is gradually being deprecated. It is necessary to migrate from FlexVolume to CSI storage to avoid affecting cluster work.

Method used

Add migration parameters in Kubernetes, block FlexVolume plug-in registration, package it as an In-tree plug-in, and then migrate to the CSI plug-in. Migrate the FlexVolume storage plug-in to the CSI plug-in, convert SC and PV parameters, and modify the CSI plug-in container registration to complete CSI. Plug-in takeover.

Benefits of technology

It realizes the migration of FlexVolume to CSI, relieves the dependence on the node environment, reduces the difficulty of deployment, improves the deployment efficiency, and can enjoy the subsequent improvement and optimization of storage by Kubernetes.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114546533B
    Figure CN114546533B
Patent Text Reader

Abstract

The invention discloses a method and system for implementing FlexVolume type storage migration to CSI storage, belonging to the field of cloud native Kubernetes storage; the method comprises the following specific steps: S1, adding migration parameters of corresponding plug-ins in Kubernetes feature; S2, shielding the registration of the FlexVolume plug-in to be migrated, and opening the In-tree plug-in registration of the plug-in; S3, packaging the FlexVolume storage plug-in into an In-tree plug-in and then migrating it to the CSI plug-in; S4, converting the existing SC and PV by using the migration of the FlexVolume storage plug-in to the CSI storage plug-in; S5, modifying the container of the Kubernetes CSI plug-in to register the migration information, and completing the takeover of the CSI plug-in; after completing the container storage migration by using the method, the cluster can be converted from calling the FlexVolume interface to calling the CSI interface without affecting the working state of the cluster and without changing the user's use mode; after migrating to the CSI, the dependence on the node environment can be eliminated, the deployment and configuration difficulty can be reduced, and the deployment efficiency can be improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention discloses a method and system for implementing migration of FlexVolume type storage to CSI storage, and relates to the technical field of cloud native Kubernetes storage. Background Art

[0002] With the increasing application of container technology in public cloud, private cloud, hybrid cloud and other fields, users have higher requirements for cloud data storage. The latest container technology has been widely used in the field of cloud computing due to its excellent performance and ease of use. Currently, Kubernetes has become the de facto standard for container orchestration technology. Kubernetes container orchestration technology can support the use of multiple storage as the underlying storage implementation of containers.

[0003] Currently, most Kubernetes storage plug-ins are of In-tree or FlexVolume type, but FlexVolume type storage often has certain requirements for the cluster environment, especially when the cluster needs to use multiple FlexVolume type storage at the same time, the requirements for the cluster environment will become complex and cumbersome, which will have higher requirements for the deployment and operation and maintenance of the environment. Therefore, Kubernetes has designed a set of CSI container storage interfaces, which can fully containerize the functional services of FlexVolume type storage, thereby decoupling from the cluster environment.

[0004] As various FlexVolume storage plug-ins have launched their own CSI versions, and FlexVolume storage will gradually be abandoned by Kubernetes and replaced by the corresponding CSI interface, a method needs to be implemented for Kubernetes clusters that are using the FlexVolume storage plug-in to migrate it to CSI storage, so that the cluster backend storage can be converted from FlexVolume to CSI without affecting the cluster operation.

[0005] Therefore, a method and system for implementing migration of FlexVolume type storage to CSI storage is now invented to solve the above problems. Summary of the invention

[0006] In view of the problems of the prior art, the present invention provides a method and system for implementing the migration of FlexVolume type storage to CSI storage. The technical solution adopted is: a method for implementing the migration of FlexVolume type storage to CSI storage, wherein the specific steps of the method are as follows:

[0007] S1 adds migration parameters of the corresponding plug-in in Kubernetes feature;

[0008] S2 blocks the registration of the FlexVolume plug-in that needs to be migrated, and enables the In-tree plug-in registration of the plug-in;

[0009] S3 packages the FlexVolume storage plug-in into an In-tree plug-in and then migrates it to the CSI plug-in;

[0010] S4 uses the migration of FlexVolume storage plug-in to CSI storage plug-in to convert existing SC and PV;

[0011] S5 modifies the container of the Kubernetes CSI plug-in to register the migration information and complete the takeover of the CSI plug-in.

[0012] The specific steps for S2 to block the registration of the FlexVolume plug-in that needs to be migrated and enable the In-tree plug-in registration of the plug-in are as follows:

[0013] S201 adds migration plugin registration in kubernetes / pkg / flexvolume / probe;

[0014] S202 Modify the newProbeEvent method to add a plug-in migration judgment;

[0015] The specific steps of converting the existing SC and PV of S4 using the FlexVolume storage plug-in to the CSI storage plug-in are as follows:

[0016] S401 compares the FlexVolume of the plug-in and the SC configuration parameters of the CSI, converts the available parameters in the FlexVolume to the CSI, and implements the SC parameter conversion;

[0017] S402 compares the parameters in the plug-in's FlexVolume and the CSI's PV, converts the available parameters in the FlexVolume to the CSI, and implements PV parameter conversion.

[0018] The S5 modifies the container of the Kubernetes CSI plug-in to register the migration information. The specific steps to complete the takeover of the CSI plug-in are as follows:

[0019] S501 modifies the external-provisioner and external-resizer containers in the Kubernetes CSI plug-in and registers the migration information of the corresponding plug-ins to these two plug-ins;

[0020] S502 completes the takeover of the PV created by the original FlexVolume by the CSI plug-in, and all requests are processed by the CSI plug-in.

[0021] A system for implementing FlexVolume type storage migration to CSI storage, the system specifically includes a parameter migration module, a plug-in modification module, a plug-in packaging module, a data conversion module and a plug-in migration module:

[0022] Parameter migration module: Add migration parameters of corresponding plug-ins in Kubernetes feature;

[0023] Plugin modification module: block the registration of the FlexVolume plugin that needs to be migrated, and enable the In-tree plugin registration of the plugin;

[0024] Plugin packaging module: packages the FlexVolume storage plug-in into an In-tree plug-in and then migrates it to the CSI plug-in;

[0025] Data conversion module: conversion of existing SC and PV using the migration of FlexVolume storage plug-in to CSI storage plug-in;

[0026] Plugin migration module: Modify the container of the Kubernetes CSI plugin to register the migration information and complete the takeover of the CSI plugin.

[0027] The plug-in modification module specifically includes a registration adding module and a migration judgment module:

[0028] Register and add modules: Add migration plug-in registration in kubernetes / pkg / flexvolume / probe;

[0029] Migration judgment module: Modify the newProbeEvent method and add the judgment on whether the plug-in should be migrated.

[0030] The data conversion module specifically includes an SC conversion module and a PV conversion module:

[0031] SC conversion module: compares the plug-in's FlexVolume and CSI's SC configuration parameters, converts the available parameters in FlexVolume to CSI, and implements SC parameter conversion;

[0032] PV conversion module: compares the parameters in the plug-in's FlexVolume and CSI's PV, converts the available parameters in FlexVolume to CSI, and implements PV parameter conversion.

[0033] The plug-in migration module specifically includes an information registration module and a request phase module:

[0034] Information registration module: Modify the external-provisioner and external-resizer containers in the Kubernetes CSI plug-in and register the migration information of the corresponding plug-ins in these two plug-ins;

[0035] Request phase module: Completes the takeover of the PV created by the original FlexVolume by the CSI plug-in and hands over all requests to the CSI plug-in for processing.

[0036] The beneficial effects of the present invention are as follows: the present invention provides a method for implementing the migration of FlexVolume type storage to CSI storage, which mainly has the following beneficial effects:

[0037] After completing the container storage migration using this method, the cluster can be switched from calling the FlexVolume interface to calling the CSI interface without affecting the cluster working status or changing the user usage method.

[0038] After migrating to CSI, you can eliminate the dependence on the node environment, reduce the difficulty of deployment and configuration, and improve deployment efficiency;

[0039] FlexVolume will gradually be abandoned by Kubernetes and replaced by CSI plug-ins. After migrating to CSI, you can enjoy the subsequent improvements and optimizations of Kubernetes on storage. BRIEF DESCRIPTION OF THE DRAWINGS

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

[0041] Figure 1 is a flow chart of modifying plug-in registration in an embodiment of the present invention; Figure 2 is a flow chart of a method for modifying plug-in registration in an embodiment of the present invention; Figure 3 is a schematic diagram of a conversion model of SC parameters in an embodiment of the present invention; Figure 4 is a schematic diagram of a conversion model of SC parameters in an embodiment of the present invention; Figure 5 is a flow chart of the method of the present invention. DETAILED DESCRIPTION

[0042] The present invention is further described below in conjunction with the accompanying drawings and specific embodiments so that those skilled in the art can better understand the present invention and implement it, but the embodiments are not intended to limit the present invention.

[0043] First, some abbreviations and key terms related to the present invention are explained:

[0044] Kubernetes: an open source container orchestration engine and a leading distributed architecture solution based on container technology;

[0045] FlexVolume: An out-of-tree storage plug-in extension supported by Kubernetes v1.8+.

[0046] In-tree plugins: low-level plugins whose code is included in the Kubernetes source code and compiled into the Kubernetes binary file;

[0047] CSI: Container Storage Interface, an RPC interface that Kubernetes uses to connect to any third-party storage plug-in;

[0048] Embodiment 1:

[0049] A method for migrating FlexVolume storage to CSI storage, wherein the method comprises the following specific steps:

[0050] S1 adds migration parameters of the corresponding plug-in in Kubernetes feature;

[0051] S2 blocks the registration of the FlexVolume plug-in that needs to be migrated, and enables the In-tree plug-in registration of the plug-in;

[0052] S3 packages the FlexVolume storage plug-in into an In-tree plug-in and then migrates it to the CSI plug-in;

[0053] S4 uses the migration of FlexVolume storage plug-in to CSI storage plug-in to convert existing SC and PV;

[0054] S5 modifies the container of the Kubernetes CSI plug-in to register the migration information and complete the takeover of the CSI plug-in;

[0055] First, add the corresponding plug-in migration parameters in Kubernetes feature according to S1. The default value is false.

[0056] Modify the CSI migration code of kube-apiserver, kube-controller-manager, kube-SCheduler, and kubelet to add judgment of new parameters

[0057] Set the corresponding startup parameters to true in kube-apiserver, kube-controller-manager, kube-SCheduler, and kubelet to enable the migration feature of the corresponding plug-in;

[0058] Adding the migration parameters is equivalent to completing the migration process from the In-tree plug-in to CSI;

[0059] Then further, the specific process is as follows Figure 1 The specific implementation method is as shown in Figure 2 As shown, the specific steps for S2 to block the registration of the FlexVolume plug-in that needs to be migrated and enable the In-tree plug-in registration of the plug-in are as follows:

[0060] S201 adds migration plugin registration in kubernetes / pkg / flexvolume / probe;

[0061] S202 Modify the newProbeEvent method to add a plug-in migration judgment;

[0062] By modifying the newProbeEvent method of kubernetes / pkg / flexvolume / probe, adding a check on whether the plug-in has been migrated, and returning "volume.ProbeEvent{},nil" if the plug-in has been migrated, you can cut off the existing FlexVolume plug-in registration and register it with the In-tree plug-in. Then, you can use the method of migrating the In-tree storage plug-in to CSI to migrate the FlexVolume storage to CSI.

[0063] Furthermore, the S3FlexVolume storage plug-in implements its own In-tree interface based on the existing In-tree template, mainly including Provision, SetUp, TearDown, TearDownDevice, etc., and is integrated into the Kubernetes source code;

[0064] This implements the whole process of packaging the FlexVolume storage plug-in into an In-tree plug-in and then migrating it to the CSI plug-in. When the FlexVolume plug-in is called to create a PV or to mount or unmount it, the CSI plug-in is actually called to perform the work.

[0065] Furthermore, the specific steps of converting the existing SC and PV of the S4 using the FlexVolume storage plug-in to migrate to the CSI storage plug-in are as follows:

[0066] S401 compares the FlexVolume of the plug-in and the SC configuration parameters of the CSI, converts the available parameters in the FlexVolume to the CSI, and implements the SC parameter conversion;

[0067] S402 compares the parameters in the plug-in's FlexVolume and the CSI's PV, converts the available parameters in the FlexVolume to the CSI, and implements PV parameter conversion;

[0068] Converting existing data is the most important step in the entire migration process. To migrate data without user awareness, all original data must be available, including PVC and PV created by the FlexVolume plug-in, and the configuration parameters of the FlexVolume plug-in, such as secret, SC, and configmap. To make these data available in the CSI plug-in, necessary conversion is required.

[0069] Kubernetes itself provides a set of conversion interfaces for use when migrating CSI in-tree. Several method implementations are defined in this interface:

[0070] TranslateIntreeStorageClassToCSI, complete the conversion of storageclass from In-tree to CSI

[0071] TranslateIntreeInlineVolumeToCSI, complete the conversion of inline volume from In-tree to CSI

[0072] TranslateIntreePVToCSI, complete the conversion of In-tree to CSI PV

[0073] TranslateCSIPVToIntree, completes the conversion of CSI to In-tree PV

[0074] The corresponding specific conversion work is as follows:

[0075] S401 compares the plug-in's FlexVolume and CSI's SC configuration parameters, converts the available parameters in FlexVolume to CSI, adds parameters that are not in FlexVolume and writes them to CSI, and replaces the Provisioner with the CSI Provisioner. The specific conversion model is as follows: Figure 3 As shown;

[0076] S402 compares the parameters in the plug-in FlexVolume and CSI PV, converts the available parameters in FlexVolume to CSI, adds parameters not in FlexVolume and writes them to CSI, and replaces Driver with CSI Driver. When CSI PV is deleted, only VolumeHandle parameter can be obtained, which is essentially the volumeId of PV, but this parameter does not exist in FlexVolume. Therefore, it is necessary to combine the necessary parameters used when deleting PV into VolumeHandle and convert it to VolumeHandle parameter of CSI. The specific conversion model is as follows: Figure 4 As shown;

[0077] It can ensure that after the migration is completed, the PV created by the original FlexVolume storage plug-in can be deleted, expanded, mounted, unmounted, and other basic operations by the new CSI plug-in;

[0078] Furthermore, the S5 modifies the container of the Kubernetes CSI plug-in to register the migration information, and the specific steps to complete the takeover of the CSI plug-in are as follows:

[0079] S501 modifies the external-provisioner and external-resizer containers in the Kubernetes CSI plug-in and registers the migration information of the corresponding plug-ins to these two plug-ins;

[0080] S502 completes the takeover of the PV created by the original FlexVolume by the CSI plug-in, and all requests are processed by the CSI plug-in.

[0081] Embodiment 2:

[0082] A system for implementing FlexVolume type storage migration to CSI storage, the system specifically includes a parameter migration module, a plug-in modification module, a plug-in packaging module, a data conversion module and a plug-in migration module:

[0083] Parameter migration module: Add migration parameters of corresponding plug-ins in Kubernetes feature;

[0084] Plugin modification module: block the registration of the FlexVolume plugin that needs to be migrated, and enable the In-tree plugin registration of the plugin;

[0085] Plugin packaging module: packages the FlexVolume storage plug-in into an In-tree plug-in and then migrates it to the CSI plug-in;

[0086] Data conversion module: conversion of existing SC and PV using the migration of FlexVolume storage plug-in to CSI storage plug-in;

[0087] Plugin migration module: Modify the container of the Kubernetes CSI plugin to register the migration information and complete the takeover of the CSI plugin;

[0088] Furthermore, the plug-in modification module specifically includes a registration adding module and a migration judgment module:

[0089] Register and add modules: Add migration plug-in registration in kubernetes / pkg / flexvolume / probe;

[0090] Migration judgment module: Modify the newProbeEvent method to add the judgment on whether the plug-in should be migrated;

[0091] Furthermore, the data conversion module specifically includes an SC conversion module and a PV conversion module:

[0092] SC conversion module: compares the plug-in's FlexVolume and CSI's SC configuration parameters, converts the available parameters in FlexVolume to CSI, and implements SC parameter conversion;

[0093] PV conversion module: compares the parameters in the plug-in's FlexVolume and CSI's PV, converts the available parameters in FlexVolume to CSI, and implements PV parameter conversion;

[0094] Furthermore, the plug-in migration module specifically includes an information registration module and a request phase module:

[0095] Information registration module: Modify the external-provisioner and external-resizer containers in the Kubernetes CSI plug-in and register the migration information of the corresponding plug-ins in these two plug-ins;

[0096] Request phase module: Completes the takeover of the PV created by the original FlexVolume by the CSI plug-in and hands over all requests to the CSI plug-in for processing.

[0097] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should 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. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present invention.

Claims

1. A method for migrating FlexVolume storage to CSI storage. Its characteristics are The specific steps of the method are as follows: S1 adds migration parameters of the corresponding plug-in in Kubernetes feature; S2 blocks the registration of the FlexVolume plug-in that needs to be migrated, and enables the In-tree plug-in registration of the plug-in; S3 packages the FlexVolume storage plug-in into an In-tree plug-in and then migrates it to the CSI plug-in; S4 uses the migration of FlexVolume storage plug-in to CSI storage plug-in to convert existing SC and PV; S5 modifies the container of the Kubernetes CSI plug-in to register the migration information and complete the takeover of the CSI plug-in.

2. The method according to claim 1, Its characteristics are The specific steps for S2 to block the registration of the FlexVolume plug-in that needs to be migrated and enable the In-tree plug-in registration of the plug-in are as follows: S201 adds migration plugin registration in kubernetes / pkg / flexvolume / probe; S202 modifies the newProbeEvent method and adds a check on whether the plug-in should be migrated.

3. The method according to claim 2, Its characteristics are The specific steps of converting the existing SC and PV of S4 using the FlexVolume storage plug-in to the CSI storage plug-in are as follows: S401 compares the FlexVolume of the plug-in and the SC configuration parameters of the CSI, converts the available parameters in the FlexVolume to the CSI, and implements the SC parameter conversion; S402 compares the parameters in the plug-in's FlexVolume and the CSI's PV, converts the available parameters in the FlexVolume to the CSI, and implements PV parameter conversion.

4. The method according to claim 3, Its characteristics are The S5 modifies the container of the Kubernetes CSI plug-in to register the migration information. The specific steps to complete the takeover of the CSI plug-in are as follows: S501 modifies the external-provisioner and external-resizer containers in the Kubernetes CSI plug-in and registers the migration information of the corresponding plug-ins to these two plug-ins; S502 completes the takeover of the PV created by the original FlexVolume by the CSI plug-in, and all requests are processed by the CSI plug-in.

5. A system for implementing migration of FlexVolume type storage to CSI storage, Its characteristics are The system specifically includes a parameter migration module, a plug-in modification module, a plug-in packaging module, a data conversion module and a plug-in migration module: Parameter migration module: Add migration parameters of corresponding plug-ins in Kubernetes feature; Plugin modification module: block the registration of the FlexVolume plugin that needs to be migrated, and enable the In-tree plugin registration of the plugin; Plugin packaging module: packages the FlexVolume storage plug-in into an In-tree plug-in and then migrates it to the CSI plug-in; Data conversion module: conversion of existing SC and PV using the migration of FlexVolume storage plug-in to CSI storage plug-in; Plugin migration module: Modify the container of the Kubernetes CSI plugin to register the migration information and complete the takeover of the CSI plugin.

6. The system according to claim 5, Its characteristics are The plug-in modification module specifically includes a registration adding module and a migration judgment module: Register and add modules: Add migration plug-in registration in kubernetes / pkg / flexvolume / probe; Migration judgment module: Modify the newProbeEvent method and add the judgment on whether the plug-in should be migrated.

7. The system according to claim 6, Its characteristics are The data conversion module specifically includes an SC conversion module and a PV conversion module: SC conversion module: compares the plug-in's FlexVolume and CSI's SC configuration parameters, converts the available parameters in FlexVolume to CSI, and implements SC parameter conversion; PV conversion module: compares the parameters in the plug-in's FlexVolume and CSI's PV, converts the available parameters in FlexVolume to CSI, and implements PV parameter conversion.

8. The system according to claim 7, Its characteristics are The plug-in migration module specifically includes an information registration module and a request phase module: Information registration module: Modify the external-provisioner and external-resizer containers in the Kubernetes CSI plug-in and register the migration information of the corresponding plug-ins in these two plug-ins; Request phase module: Completes the takeover of the PV created by the original FlexVolume by the CSI plug-in and hands over all requests to the CSI plug-in for processing.