# Provisioning the NFS Shared Folder

A storage resource is provisioned in OpenShift by the cluster administrator through a Persistent Volume (PV), which has to be of type NFS. A project can then claim that resource through a Persistent Volume Claim (PVC). That claim will eventually be mounted as a volume inside containers.

In the case of an EMS project, we create one PV and one PVC at the same time since these are meant to be bound together.

## Procedure

1. Modify the samples/openshift/nfs-pv-pvc.yaml file for your setup.

       apiVersion: v1
       kind: PersistentVolume
       metadata:
         name: pv-nfs-ems-project
         annotations:
           # Should be replaced by spec.mountOptions in the future
           volume.beta.kubernetes.io/mount-options: soft (1)
       spec:
         capacity:
           storage: 1Gi
         accessModes:
         - ReadWriteMany
         nfs:
           path: /vol/home/user/OpenShift/shared (2)
           server: 10.98.128.50 (3)
         persistentVolumeReclaimPolicy: Retain
         claimRef:
           name: claim-nfs-ems-project
           namespace: ems-project (4)
       ---
       apiVersion: v1
       kind: PersistentVolumeClaim
       metadata:
         name: claim-nfs-ems-project
       spec:
         accessModes:
           - ReadWriteMany
         resources:
           requests:
             storage: 1Gi
         volumeName: pv-nfs-ems-project

   `(1)`: Optional comma-separated list of NFS mount options used when the PV is mounted on a cluster node.

   `(2)`: The path that is exported by the NFS server. In this example, we want the patch to match the `~/OpenShift/shared` folder created in Setting Up the Shared Folder.

   `(3)`: The host name or IP address of the NFS server.

   `(4)`: This needs to match the name of the project created previously.

2. Switch to the `system:admin` cluster administrator and create the PV and PVC:

       > oc login -u system:admin
       > oc create -n ems-project -f nfs-pv-pvc.yaml

3. Check the result using the following command:

       > oc get pv,pvc

   Note: The same PV/PVC can be used by multiple pods within the same project.

   Creating the PV/PVC is done once for the lifetime of the project.

Copyright © Cloud Software Group, Inc. All rights reserved.