module
Version:
v0.2.0
Opens a new window with list of versions in this module.
Published: Jul 21, 2021
License: Apache-2.0
Opens a new window with license information.
README
¶
pvmigrate
pvmigrate allows migrating PVCs between two StorageClasses by creating new PVs, copying over the data, and then changing PVCs to refer to the new PVs.
examples
To migrate PVs from the 'default' StorageClass to mynewsc:
pvmigrate --source-sc default --dest-sc mynewsc
process
In order, it:
- Validates that both the source and dest StorageClasses exist
- Finds PVs using the source StorageClass
- Finds PVCs corresponding to the above PVs
- Creates new PVCs for each existing PVC, but using the new StorageClass
- Finds all pods mounting the existing PVCs
- Finds StatefulSets and Deployments controlling those pods and sets their scale to 0, recording the original scale for later
- Waits for all pods mounting the existing PVCs to be removed
- Creates a pod mounting both the original and replacement PVC, which then
rsync
s data between the two (and repeats this for each PVC)
- Marks all the PVs associated with the original and replacement PVCs as 'retain', so that they will not be deleted when the PVCs are removed
- Deletes the original PVCs so that their names are available, and removes the association between their PV and the removed PVC
- Deletes the replacement PVCs so that their PVs are available, and removes the association between their PV and the removed PVC
- Creates new PVCs with the original names, but associated with the replacement PVs
- Resets the scales of the affected StatefulSets and Deployments
- Deletes the original PVs
known limitations
- If the migration process is interrupted in the middle, it will not always be resumed properly when rerunning
- All pods are stopped at once, instead of stopping only the pods whose PVCs are being migrated
- PVCs are not migrated in parallel
- Constructs other than StatefulSets and Deployments are not handled (for instance, DaemonSets and Jobs), and will cause pvmigrate to exit with an error
- Pods not controlled by a StatefulSet or Deployment are not handled, and will cause pvmigrate to exit with an error
- PVs without associated PVCs are not handled, and will cause pvmigrate to exit with an error
Directories
¶
|
|
pkg
|
|
|
|
|
|
Click to show internal directories.
Click to hide internal directories.