Using persistent storage in pods
Previously, we created all required PV OpenShift API objects, which are provided by OpenStack cluster administrators. Now, we are going to show you how to use persistent storage in your applications. Any OpenShift users can request persistent volume through the PVC concept.
Requesting persistent volume
Once the PV resource is available, any OpenShift user can create a PVC to request storage and later use that PVC to attach it as a volume to containers in pods.
Note
Upcoming examples don't have to be run under the system:admin
account. Any unprivileged OpenShift user can request persistent volumes using PVC.
Users should create PVC definitions using either YAML or JSON syntax. The following example shows a claim that requests 1 GiB of persistent storage with ReadWriteOnce
capabilities:
# cat pvc-db.yaml
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: pvc-db
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 1Gi
Now...