<commit_before>// Module included in the following assemblies:
//
// * storage/persistent-storage/persistent-storage-nfs.adoc

[id="persistent-storage-nfs-provisioning_{context}"]
= Provisioning

Storage must exist in the underlying infrastructure before it can be
mounted as a volume in {product-title}. To provision NFS volumes,
a list of NFS servers and export paths are all that is required.

.Procedure

. Create an object definition for the PV:
+
[source,yaml]
----
apiVersion: v1
kind: PersistentVolume
metadata:
  name: pv0001 <1>
spec:
  capacity:
    storage: 5Gi <2>
  accessModes:
  - ReadWriteOnce <3>
  nfs: <4>
    path: /tmp <5>
    server: 172.17.0.2 <6>
  persistentVolumeReclaimPolicy: Retain <7>
----
<1> The name of the volume. This is the PV identity in various `oc <command>
pod` commands.
<2> The amount of storage allocated to this volume.
<3> Though this appears to be related to controlling access to the volume,
it is actually used similarly to labels and used to match a PVC to a PV.
Currently, no access rules are enforced based on the `accessModes`.
<4> The volume type being used, in this case the `nfs` plug-in.
<5> The path that is exported by the NFS server.
<6> The host name or IP address of the NFS server.
<7> The reclaim policy for the PV. This defines what happens to a volume
when released.
+
[NOTE]
====
Each NFS volume must be mountable by all schedulable nodes in the cluster.
====

. Verify that the PV was created:
+
----
$ oc get pv
NAME     LABELS    CAPACITY     ACCESSMODES   STATUS      CLAIM  REASON    AGE
pv0001   <none>    5368709120   RWO           Available                    31s
----

. Create a persistent volume claim which binds to the new PV:
+
[source,yaml]
----
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: nfs-claim1
spec:
  accessModes:
    - ReadWriteOnce <1>
  resources:
    requests:
      storage: 5Gi <2>
----
<1> As mentioned above for PVs, the `*accessModes*` do not enforce security, but
rather act as labels to match a PV to a PVC.
<2> This claim looks for PVs offering *1Gi* or greater capacity.

. Verify that the persistent volume claim was created:
+
----
$ oc get pvc
NAME         STATUS   VOLUME   CAPACITY   ACCESS MODES   STORAGECLASS   AGE
nfs-claim1   Bound    pv0001   4Gi        RWO            gp2            2m
----<commit_msg>BZ1759428 to align sample capacity to 5Gi<commit_after>// Module included in the following assemblies:
//
// * storage/persistent-storage/persistent-storage-nfs.adoc

[id="persistent-storage-nfs-provisioning_{context}"]
= Provisioning

Storage must exist in the underlying infrastructure before it can be
mounted as a volume in {product-title}. To provision NFS volumes,
a list of NFS servers and export paths are all that is required.

.Procedure

. Create an object definition for the PV:
+
[source,yaml]
----
apiVersion: v1
kind: PersistentVolume
metadata:
  name: pv0001 <1>
spec:
  capacity:
    storage: 5Gi <2>
  accessModes:
  - ReadWriteOnce <3>
  nfs: <4>
    path: /tmp <5>
    server: 172.17.0.2 <6>
  persistentVolumeReclaimPolicy: Retain <7>
----
<1> The name of the volume. This is the PV identity in various `oc <command>
pod` commands.
<2> The amount of storage allocated to this volume.
<3> Though this appears to be related to controlling access to the volume,
it is actually used similarly to labels and used to match a PVC to a PV.
Currently, no access rules are enforced based on the `accessModes`.
<4> The volume type being used, in this case the `nfs` plug-in.
<5> The path that is exported by the NFS server.
<6> The host name or IP address of the NFS server.
<7> The reclaim policy for the PV. This defines what happens to a volume
when released.
+
[NOTE]
====
Each NFS volume must be mountable by all schedulable nodes in the cluster.
====

. Verify that the PV was created:
+
----
$ oc get pv
NAME     LABELS    CAPACITY     ACCESSMODES   STATUS      CLAIM  REASON    AGE
pv0001   <none>    5368709120   RWO           Available                    31s
----

. Create a persistent volume claim that binds to the new PV:
+
[source,yaml]
----
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: nfs-claim1
spec:
  accessModes:
    - ReadWriteOnce <1>
  resources:
    requests:
      storage: 5Gi <2>
----
<1> As mentioned above for PVs, the `*accessModes*` do not enforce security, but
rather act as labels to match a PV to a PVC.
<2> This claim looks for PVs offering *5Gi* or greater capacity.

. Verify that the persistent volume claim was created:
+
----
$ oc get pvc
NAME         STATUS   VOLUME   CAPACITY   ACCESS MODES   STORAGECLASS   AGE
nfs-claim1   Bound    pv0001   5Gi        RWO            gp2            2m
----
{'fraction_non_alphanumeric': 0.08434504792332269, 'fraction_numerical': 0.0268370607028754, 'mean_word_length': 2.98303647158609, 'pattern_counts': {'":': 0, '<': 43, '<?xml version=': 0, '>': 43, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 2, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4551906', 'n_tokens_mistral': 1568, 'n_tokens_neox': 1445, 'n_words': 646}