From 1088bca0246742beb18687c559f7753b436a3f31 Mon Sep 17 00:00:00 2001 From: Adnan Abdulhussein Date: Wed, 14 Jun 2017 08:55:58 +0200 Subject: [PATCH] update pod persistent volume example storage class (#3979) * update pod persistent volume example storage class When binding to a manually created PersistentVolume, the claim must disable dynamic provisioning by specifying an empty storage class. Fixes #2803 * use specific storageclass * revert gibibytes -> gigabytes change --- .../configure-persistent-volume-storage.md | 21 ++++++++++--------- .../task-pv-claim.yaml | 1 + .../task-pv-volume.yaml | 1 + 3 files changed, 13 insertions(+), 10 deletions(-) diff --git a/docs/tasks/configure-pod-container/configure-persistent-volume-storage.md b/docs/tasks/configure-pod-container/configure-persistent-volume-storage.md index d04baca63b..8c9f69617c 100644 --- a/docs/tasks/configure-pod-container/configure-persistent-volume-storage.md +++ b/docs/tasks/configure-pod-container/configure-persistent-volume-storage.md @@ -68,7 +68,9 @@ Here is the configuration file for the hostPath PersistentVolume: The configuration file specifies that the volume is at `/tmp/data` on the the cluster's Node. The configuration also specifies a size of 10 gibibytes and an access mode of `ReadWriteOnce`, which means the volume can be mounted as -read-write by a single Node. +read-write by a single Node. It defines the [StorageClass name](https://kubernetes.io/docs/concepts/storage/persistent-volumes/#class) +`manual` for the PersistentVolume, which will be used to bind +PersistentVolumeClaim requests to this PersistentVolume. Create the PersistentVolume: @@ -81,9 +83,8 @@ View information about the PersistentVolume: The output shows that the PersistentVolume has a `STATUS` of `Available`. This means it has not yet been bound to a PersistentVolumeClaim. - NAME CAPACITY ACCESSMODES RECLAIMPOLICY STATUS CLAIM REASON AGE - task-pv-volume 10Gi RWO Retain Available 17s - + NAME CAPACITY ACCESSMODES RECLAIMPOLICY STATUS CLAIM STORAGECLASS REASON AGE + task-pv-volume 10Gi RWO Retain Available manual 4s ## Create a PersistentVolumeClaim @@ -102,7 +103,8 @@ Create the PersistentVolumeClaim: After you create the PersistentVolumeClaim, the Kubernetes control plane looks for a PersistentVolume that satisfies the claim's requirements. If the control -plane finds a suitable PersistentVolume, it binds the claim to the volume. +plane finds a suitable PersistentVolume with the same StorageClass, it binds the +claim to the volume. Look again at the PersistentVolume: @@ -110,9 +112,8 @@ Look again at the PersistentVolume: Now the output shows a `STATUS` of `Bound`. - kubectl get pv task-pv-volume - NAME CAPACITY ACCESSMODES RECLAIMPOLICY STATUS CLAIM REASON AGE - task-pv-volume 10Gi RWO Retain Bound default/task-pv-claim 8m + NAME CAPACITY ACCESSMODES RECLAIMPOLICY STATUS CLAIM STORAGECLASS REASON AGE + task-pv-volume 10Gi RWO Retain Bound default/task-pv-claim manual 2m Look at the PersistentVolumeClaim: @@ -121,8 +122,8 @@ Look at the PersistentVolumeClaim: The output shows that the PersistentVolumeClaim is bound to your PersistentVolume, `task-pv-volume`. - NAME STATUS VOLUME CAPACITY ACCESSMODES AGE - task-pv-claim Bound task-pv-volume 10Gi RWO 5s + NAME STATUS VOLUME CAPACITY ACCESSMODES STORAGECLASS AGE + task-pv-claim Bound task-pv-volume 10Gi RWO manual 30s ## Create a Pod diff --git a/docs/tasks/configure-pod-container/task-pv-claim.yaml b/docs/tasks/configure-pod-container/task-pv-claim.yaml index fc82113f41..197db917c8 100644 --- a/docs/tasks/configure-pod-container/task-pv-claim.yaml +++ b/docs/tasks/configure-pod-container/task-pv-claim.yaml @@ -3,6 +3,7 @@ apiVersion: v1 metadata: name: task-pv-claim spec: + storageClassName: manual accessModes: - ReadWriteOnce resources: diff --git a/docs/tasks/configure-pod-container/task-pv-volume.yaml b/docs/tasks/configure-pod-container/task-pv-volume.yaml index bffcc7ae97..5fa1edb55f 100644 --- a/docs/tasks/configure-pod-container/task-pv-volume.yaml +++ b/docs/tasks/configure-pod-container/task-pv-volume.yaml @@ -5,6 +5,7 @@ metadata: labels: type: local spec: + storageClassName: manual capacity: storage: 10Gi accessModes: