Skip to content

Commit 0e8319e

Browse files
prateekpandey14Kiran Mova
authored andcommitted
chore(docs): update snapshot docs to include api version info
Signed-off-by: prateekpandey14 <[email protected]>
1 parent b6b36ae commit 0e8319e

File tree

1 file changed

+39
-7
lines changed

1 file changed

+39
-7
lines changed

docs/tutorial/volumes/snapshot.md

Lines changed: 39 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -24,25 +24,42 @@ Before creating a Volume Snapshot, a `VolumeSnapshotClass` must be set up.
2424

2525
```yaml
2626
kind: VolumeSnapshotClass
27-
apiVersion: snapshot.storage.k8s.io/v1beta1
27+
apiVersion: snapshot.storage.k8s.io/v1
2828
metadata:
2929
name: csi-cstor-snapshotclass
30-
namespace: kube-system
3130
annotations:
3231
snapshot.storage.kubernetes.io/is-default-class: "true"
3332
driver: cstor.csi.openebs.io
3433
deletionPolicy: Delete
3534
```
3635

37-
The driver points to OpenEBS Cstor CSI driver. The deletionPolicy can be set to `Delete` or `Retain`. When set to Retain, the underlying physical snapshot on the storage cluster is retained even when the VolumeSnapshot object is deleted.
36+
The driver points to OpenEBS CStor CSI driver. The `deletionPolicy` can be set to `Delete` or `Retain`. When set to Retain, the underlying physical snapshot on the storage cluster is retained even when the VolumeSnapshot object is deleted.
37+
38+
#### Note: In some cluster like OpenShift(OCP) 4.5, which only installs the `v1beta1` version of `VolumeSnapshotClass` as supported version, then you may get the API error like:
39+
40+
```
41+
$ kubectl apply -f snapshotclass.yaml
42+
no matches for kind "VolumeSnapshotClass" in version "snapshot.storage.k8s.io/v1"
43+
```
44+
in such cases you can change the apiVersion to use `v1beta1` version instead of `v1` shown below:
45+
46+
```yaml
47+
kind: VolumeSnapshotClass
48+
apiVersion: snapshot.storage.k8s.io/v1beta1
49+
metadata:
50+
name: csi-cstor-snapshotclass
51+
annotations:
52+
snapshot.storage.kubernetes.io/is-default-class: "true"
53+
driver: cstor.csi.openebs.io
54+
deletionPolicy: Delete
3855
3956
4057
### Create a Snapshot of a Volume
4158
4259
To create a snapshot of a volume, here's an example of a YAML file that defines a snapshot:
4360
4461
```yaml
45-
apiVersion: snapshot.storage.k8s.io/v1beta1
62+
apiVersion: snapshot.storage.k8s.io/v1
4663
kind: VolumeSnapshot
4764
metadata:
4865
name: cstor-pvc-snap
@@ -92,7 +109,24 @@ Status:
92109
The `SnapshotContentName` identifies the `VolumeSnapshotContent` object which serves this snapshot. The Ready To Use parameter indicates that the Snapshot created successfully and
93110
can be used to create a new PVC.
94111

112+
#### Note: In some cluster like OpenShift(OCP) 4.5, which only installs the `v1beta1` version of `VolumeSnapshots` as supported version, then you may get the API error like:
95113

114+
```
115+
$ kubectl apply -f snapshot.yaml
116+
no matches for kind "VolumeSnapshot" in version "snapshot.storage.k8s.io/v1"
117+
```
118+
in such cases you can change the apiVersion to use `v1beta1` version instead of `v1` shown below:
119+
120+
```yaml
121+
apiVersion: snapshot.storage.k8s.io/v1beta1
122+
kind: VolumeSnapshot
123+
metadata:
124+
name: cstor-pvc-snap
125+
spec:
126+
volumeSnapshotClassName: csi-cstor-snapshotclass
127+
source:
128+
persistentVolumeClaimName: cstor-pvc
129+
```
96130
97131
### Create PVCs from VolumeSnapshots
98132
@@ -118,14 +152,12 @@ spec:
118152
119153
The `dataSource` shows that the PVC must be created using a `VolumeSnapshot` named `cstor-pvc-snap` as the source of the data. This instructs CStor CSI to create a PVC from the snapshot. Once the PVC is created, it can be attached to a pod and used just like any other PVC.
120154

121-
```sh
122-
123155

124156
5. Verify that the PVC has been successfully created:
157+
125158
```
126159
kubectl get pvc
127160
NAME STATUS VOLUME CAPACITY ACCESS MODES STORAGECLASS AGE
128161
cstor-pvc Bound pvc-52d88903-0518-11ea-b887-42010a80006c 5Gi RWO cstor-csi-disk 1d
129162
restore-cstor-pvc Bound pvc-2f2d65fc-0784-11ea-b887-42010a80006c 5Gi RWO cstor-csi-disk 5s
130-
`
131163
```

0 commit comments

Comments
 (0)