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:
...
You can view the name of a PVC that is bound to a PV by running the following command:
$ oc get pv <pv_name> -o jsonpath='{.spec.claimRef.name}'
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. |
4.5.3.1. Last phase transition time リンクのコピーリンクがクリップボードにコピーされました!
The LastPhaseTransitionTime field has a timestamp that updates every time a persistent volume (PV) transitions to a different phase (pv.Status.Phase). To find the time of the last phase transition for a PV, run the following command:
$ oc get pv <pv_name> -o json | jq '.status.lastPhaseTransitionTime'
- 1
- Specify the name of the PV that you want to see the last phase transition.
4.5.3.2. 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
The mountOptions parameter values are not validated. Incorrect values cause the mount to fail and an event to be logged to the PVC.