From 029b95a57f9d16092d412401584d1273b2799aef Mon Sep 17 00:00:00 2001 From: Vikram Katkar <15381618+vikram-katkar@users.noreply.github.com> Date: Mon, 8 Aug 2022 16:19:49 +0200 Subject: [PATCH 1/2] fix: reserve a PV for static provisioning Set `volumeNmae` explicitly to avoid falling back to dynamic provisioning. Ref: https://kubernetes.io/docs/concepts/storage/persistent-volumes/#reserving-a-persistentvolume --- examples/kubernetes/static-provisioning/manifests/claim.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/examples/kubernetes/static-provisioning/manifests/claim.yaml b/examples/kubernetes/static-provisioning/manifests/claim.yaml index ae94fa6fb9..efa92b78b2 100644 --- a/examples/kubernetes/static-provisioning/manifests/claim.yaml +++ b/examples/kubernetes/static-provisioning/manifests/claim.yaml @@ -3,6 +3,8 @@ kind: PersistentVolumeClaim metadata: name: ebs-claim spec: + storageClassName: "" # Empty string must be explicitly set otherwise default StorageClass will be set + volumeName: test-pv accessModes: - ReadWriteOnce resources: From 1a15842d55e2dfad0eb8cdc455ed1043cfb55c9c Mon Sep 17 00:00:00 2001 From: Vikram Katkar <15381618+vikram-katkar@users.noreply.github.com> Date: Mon, 8 Aug 2022 16:20:39 +0200 Subject: [PATCH 2/2] doc: update pvc binding --- examples/kubernetes/static-provisioning/README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/examples/kubernetes/static-provisioning/README.md b/examples/kubernetes/static-provisioning/README.md index 08634679d1..d63b356505 100644 --- a/examples/kubernetes/static-provisioning/README.md +++ b/examples/kubernetes/static-provisioning/README.md @@ -48,8 +48,8 @@ This example shows you how to create and consume a `PersistentVolume` from an ex ```sh $ kubectl get pvc ebs-claim - NAME STATUS VOLUME CAPACITY ACCESS MODES STORAGECLASS AGE - ebs-claim Bound pvc-119a0c81-f45a-4bec-a116-c36cc428cc57 5Gi RWO gp2 53s + NAME STATUS VOLUME CAPACITY ACCESS MODES STORAGECLASS AGE + ebs-claim Bound test-pv 5Gi RWO 53s ``` 4. Validate the pod successfully wrote data to the statically provisioned volume: @@ -67,4 +67,4 @@ This example shows you how to create and consume a `PersistentVolume` from an ex persistentvolumeclaim "ebs-claim" deleted pod "app" deleted persistentvolume "test-pv" deleted - ``` + ``` \ No newline at end of file