diff --git a/docs/kubernetes/user-guides/snapshots.md b/docs/kubernetes/user-guides/snapshots.md index f27b8f32ba..93f3c1300f 100644 --- a/docs/kubernetes/user-guides/snapshots.md +++ b/docs/kubernetes/user-guides/snapshots.md @@ -122,3 +122,145 @@ lost+found sample-file.txt ``` + +### Tips on Migrating from Alpha Snapshots + +The api version has changed between the alpha and beta releases of the CSI +snapshotter. In many cases, snapshots created with the alpha will not be able to +be used with a beta driver. In some cases, they can be migrated. + +*You may lose all data in your snapshot!* + +*These instructions not work in your case and could delete all data in your +snapshot!* + +These instructions happened to work with a particular GKE configuration. Because +of the variety of alpha deployments, it is not possible to verify these steps +will work all of the time. The following has been tested with a GKE cluster of +master version 1.17.5-gke.0 using the following image versions for the +snapshot-controller and PD CSI driver: + + * snapshot-controller:v2.0.1 + * csi-provisioner:v1.5.0-gke.0 + * gke.gcr.io/csi-attacher:v2.1.1-gke.0 + * gke.gcr.io/csi-resizer:v0.4.0-gke.0 + * gke.gcr.io/csi-snapshotter:v2.1.1-gke.0 + * gke.gcr.io/gcp-compute-persistent-disk-csi-driver:v0.7.0-gke.0 + +#### Overview + +The idea is to provision a `VolumeSnapshotContents` in your new or upgraded beta +PD CSI driver cluster with the PD snapshot handle from the alpha snapshot, then +bind that to a new beta `VolumeSnapshot`. + +If you are able to set (or have already set) the `deletionPolicy` of any +existing alpha `VolumeSnapshotContents` and alpha `VolumeSnapshotClass` to +`Retain`, then deleting the snapshot CRs will not delete the underlying PD +snapshot. This can provision a beta `VolumeSnapshotContents` as described below. + +If you are creating a new cluster rather than upgrading an existing one, the +method below could also be used before deleting the alpha cluster and/or alpha +PD CSI driver deployment. This may be a safer option if you are not sure about +the deletion policy of your alpha snapshot. + +#### Steps to restore from an existing snapshot. + +These steps are to take place in a cluster with the beta PD CSI driver +installed. At not point is the alpha cluster or driver referenced. After this is +done, using the alpha snapshot may conflict with the resources created below in +the beta cluster. + + 1. Confirm in + [console.cloud.google.com/compute/snapshots](https://console.cloud.google.com/compute/snapshots) + that your desired snapshots exist. Note the snapshot name, which looks like + `snapshot-XXXXXXXX-XXXX-XXXX-XXXX-XXXX-XXXXXXXX`, and set an env variable: + `export SNAPSHOT_NAME=snapshot-XXXXXXXX-XXXX-XXXX-XXXX-XXXX-XXXXXXXX` (copy + in your exact name). + 1. Export your project id: `export PROJECT_ID=`. + 1. Create a `SnapshotVolume` resource which will be bound to a pre-provisioned + `SnapshotVolumeContents`. Note this is called `restored-snapshot`; this + name can be changed, but do it consistently across the other resources. + ```console + kubectl apply -f - <