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
This commit is contained in:
Adnan Abdulhussein
2017-06-14 08:55:58 +02:00
committed by Andrew Chen
parent eb71492f88
commit 1088bca024
3 changed files with 13 additions and 10 deletions
@@ -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 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 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 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: Create the PersistentVolume:
@@ -81,9 +83,8 @@ View information about the PersistentVolume:
The output shows that the PersistentVolume has a `STATUS` of `Available`. This The output shows that the PersistentVolume has a `STATUS` of `Available`. This
means it has not yet been bound to a PersistentVolumeClaim. means it has not yet been bound to a PersistentVolumeClaim.
NAME CAPACITY ACCESSMODES RECLAIMPOLICY STATUS CLAIM REASON AGE NAME CAPACITY ACCESSMODES RECLAIMPOLICY STATUS CLAIM STORAGECLASS REASON AGE
task-pv-volume 10Gi RWO Retain Available 17s task-pv-volume 10Gi RWO Retain Available manual 4s
## Create a PersistentVolumeClaim ## Create a PersistentVolumeClaim
@@ -102,7 +103,8 @@ Create the PersistentVolumeClaim:
After you create the PersistentVolumeClaim, the Kubernetes control plane looks After you create the PersistentVolumeClaim, the Kubernetes control plane looks
for a PersistentVolume that satisfies the claim's requirements. If the control 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: Look again at the PersistentVolume:
@@ -110,9 +112,8 @@ Look again at the PersistentVolume:
Now the output shows a `STATUS` of `Bound`. Now the output shows a `STATUS` of `Bound`.
kubectl get pv task-pv-volume NAME CAPACITY ACCESSMODES RECLAIMPOLICY STATUS CLAIM STORAGECLASS REASON AGE
NAME CAPACITY ACCESSMODES RECLAIMPOLICY STATUS CLAIM REASON AGE task-pv-volume 10Gi RWO Retain Bound default/task-pv-claim manual 2m
task-pv-volume 10Gi RWO Retain Bound default/task-pv-claim 8m
Look at the PersistentVolumeClaim: Look at the PersistentVolumeClaim:
@@ -121,8 +122,8 @@ Look at the PersistentVolumeClaim:
The output shows that the PersistentVolumeClaim is bound to your PersistentVolume, The output shows that the PersistentVolumeClaim is bound to your PersistentVolume,
`task-pv-volume`. `task-pv-volume`.
NAME STATUS VOLUME CAPACITY ACCESSMODES AGE NAME STATUS VOLUME CAPACITY ACCESSMODES STORAGECLASS AGE
task-pv-claim Bound task-pv-volume 10Gi RWO 5s task-pv-claim Bound task-pv-volume 10Gi RWO manual 30s
## Create a Pod ## Create a Pod
@@ -3,6 +3,7 @@ apiVersion: v1
metadata: metadata:
name: task-pv-claim name: task-pv-claim
spec: spec:
storageClassName: manual
accessModes: accessModes:
- ReadWriteOnce - ReadWriteOnce
resources: resources:
@@ -5,6 +5,7 @@ metadata:
labels: labels:
type: local type: local
spec: spec:
storageClassName: manual
capacity: capacity:
storage: 10Gi storage: 10Gi
accessModes: accessModes: