From cd0f09f6d5abc5b4d2127794f9727ddb6ff11654 Mon Sep 17 00:00:00 2001 From: Patrick Ohly Date: Mon, 8 Jul 2019 17:49:38 +0200 Subject: [PATCH] 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. --- README.md | 9 +++++---- examples/csi-app-inline.yaml | 2 +- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 6a2fbb2fe..8340e7699 100644 --- a/README.md +++ b/README.md @@ -82,7 +82,7 @@ csi-hostpathplugin-0 2/2 Running 0 5m45s 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`: ```shell -$ kubectl create -f ./examples +$ for i in ./examples/csi-storageclass.yaml ./examples/csi-pvc.yaml ./examples/csi-app.yaml; do kubectl apply -f $i; done pod/my-csi-app created persistentvolumeclaim/csi-pvc created 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 > Events: > ``` -Use the volume snapshot class to dynamically create a volume snapshot: +After having created the `csi-pvc` as described in the example above, +use the volume snapshot class to dynamically create a volume snapshot: -> $ kubectl create -f examples/csi-snapshot.yaml +> $ kubectl apply -f examples/csi-snapshot.yaml > ``` > volumesnapshot.snapshot.storage.k8s.io/new-snapshot-demo created > ``` @@ -324,7 +325,7 @@ Use the volume snapshot class to dynamically create a volume snapshot: Follow the following example to create a volume from a volume snapshot: -> $ kubectl create -f examples/csi-restore.yaml +> $ kubectl apply -f examples/csi-restore.yaml > `persistentvolumeclaim/hpvc-restore created` > > $ kubectl get pvc diff --git a/examples/csi-app-inline.yaml b/examples/csi-app-inline.yaml index ca88e9875..85b314065 100644 --- a/examples/csi-app-inline.yaml +++ b/examples/csi-app-inline.yaml @@ -1,7 +1,7 @@ kind: Pod apiVersion: v1 metadata: - name: my-csi-app + name: my-csi-app-inline spec: containers: - name: my-frontend