Skip to content

Commit cd0f09f

Browse files
committed
README.md: fix and clarify examples
The previous `kubectl create -f examples` no longer worked as intended after adding several more example yamls, in particular because csi-app-inline.yaml reused the pod name. When selecting files explicitly, the previous example works again as before. The pod name in csi-app-inline.yaml gets changed such that it can be used in parallel. This approach was chosen instead of moving files into sub-directories because csi-storageclass.yaml is needed by more than one example. When using "kubectl apply" instead of "kubectl create" we could (theoretically) re-use files in different examples without causing errors. In practice, the raw block example is currently not explicitly called out in the README.md. The snapshotting example however can't be used stand-alone and depends on the simple PVC.
1 parent 7d4b674 commit cd0f09f

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

README.md

+5-4
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ csi-hostpathplugin-0 2/2 Running 0 5m45s
8282
From the root directory, deploy the application pods including a storage class, a PVC, and a pod which mounts a volume using the Hostpath driver found in directory `./examples`:
8383

8484
```shell
85-
$ kubectl create -f ./examples
85+
$ for i in ./examples/csi-storageclass.yaml ./examples/csi-pvc.yaml ./examples/csi-app.yaml; do kubectl apply -f $i; done
8686
pod/my-csi-app created
8787
persistentvolumeclaim/csi-pvc created
8888
storageclass.storage.k8s.io/csi-hostpath-sc created
@@ -234,9 +234,10 @@ Since volume snapshot is an alpha feature starting in Kubernetes v1.12, you need
234234
> Events: <none>
235235
> ```
236236
237-
Use the volume snapshot class to dynamically create a volume snapshot:
237+
After having created the `csi-pvc` as described in the example above,
238+
use the volume snapshot class to dynamically create a volume snapshot:
238239
239-
> $ kubectl create -f examples/csi-snapshot.yaml
240+
> $ kubectl apply -f examples/csi-snapshot.yaml
240241
> ```
241242
> volumesnapshot.snapshot.storage.k8s.io/new-snapshot-demo created
242243
> ```
@@ -324,7 +325,7 @@ Use the volume snapshot class to dynamically create a volume snapshot:
324325
325326
Follow the following example to create a volume from a volume snapshot:
326327
327-
> $ kubectl create -f examples/csi-restore.yaml
328+
> $ kubectl apply -f examples/csi-restore.yaml
328329
> `persistentvolumeclaim/hpvc-restore created`
329330
>
330331
> $ kubectl get pvc

examples/csi-app-inline.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
kind: Pod
22
apiVersion: v1
33
metadata:
4-
name: my-csi-app
4+
name: my-csi-app-inline
55
spec:
66
containers:
77
- name: my-frontend

0 commit comments

Comments
 (0)