Creating the persistent volume claim (PVC) using storage classes

This task provides the procedure for automatically creating the persistent volume (PV) and the persistent volume claim (PVC) using storage classes.

Before you begin

You must first create the storage classes. See the following example for more details OpenShift dynamic NFS persistent volume using NFS-client-provisioner.

Procedure

  1. Persistent volume claim (PVC):
    1. Create a file for the persistent volume claim configuration, ier-pvc.
      kind: PersistentVolumeClaim
      apiVersion: v1
      metadata:
        name: ier-instance
      spec:
        accessModes:
          - ReadWriteMany
        resources:
          requests:
            storage: 1Gi
        storageClassName: managed-nfs-storage
    2. Save the file as ier-pvc.yaml.
    3. Run the following command:
      kubectl apply -f ier-pvc.yaml
  2. Set the following permission on the folders which are mounted as persistent volumes:
    chown -Rf 50001:0 /var
    chmod -Rf g=u /var