4.5. Persistent volumes
Each PV contains a spec and status, which is the specification and status of the volume, for example:
PersistentVolume object definition example
apiVersion: v1
kind: PersistentVolume
metadata:
name: pv0001
spec:
capacity:
storage: 5Gi
accessModes:
- ReadWriteOnce
persistentVolumeReclaimPolicy: Retain
...
status:
...
4.5.1. Capacity リンクのコピーリンクがクリップボードにコピーされました!
Generally, a persistent volume (PV) has a specific storage capacity. This is set by using the capacity attribute of the PV.
Currently, storage capacity is the only resource that can be set or requested. Future attributes may include IOPS, throughput, and so on.
4.5.2. Supported access modes リンクのコピーリンクがクリップボードにコピーされました!
LVMS is the only CSI plugin Red Hat build of MicroShift supports. The hostPath and LVs built in to OpenShift Container Platform also support RWO.
4.5.3. Phase リンクのコピーリンクがクリップボードにコピーされました!
Volumes can be found in one of the following phases:
| Phase | Description |
|---|---|
| Available | A free resource not yet bound to a claim. |
| Bound | The volume is bound to a claim. |
| Released | The claim was deleted, but the resource is not yet reclaimed by the cluster. |
| Failed | The volume has failed its automatic reclamation. |
You can view the name of the PVC that is bound to the PV by running the following command:
$ oc get pv <pv_claim>
4.5.3.1. Mount options リンクのコピーリンクがクリップボードにコピーされました!
You can specify mount options while mounting a PV by using the attribute mountOptions.
For example:
Mount options example
apiVersion: storage.k8s.io/v1
kind: StorageClass
metadata:
annotations:
storageclass.kubernetes.io/is-default-class: "true"
name: topolvm-provisioner
mountOptions:
- uid=1500
- gid=1500
parameters:
csi.storage.k8s.io/fstype: xfs
provisioner: topolvm.io
reclaimPolicy: Delete
volumeBindingMode: WaitForFirstConsumer
allowVolumeExpansion: true
mountOptions are not validated. Incorrect values will cause the mount to fail and an event to be logged to the PVC.