This procedure shows how to create a Persistent Volume Claim (PVC) in your Kubernetes cluster to access your NFS shared storage.
Before you begin
This procedure requires the following items and configurations:
-
Kubernetes version 1.15.x or higher
-
Konvoy version 1.4.x or higher
-
Valid Persistent Volume installed
Create a Persistent Volume Claim
Create a Persistent Volume Claim to access your NFS share storage.
-
Create a file called
nfs-share.yaml
similar to the example below.apiVersion: v1 kind: PersistentVolumeClaim metadata: name: nfs-share # The name of this Persistent Volume Claim namespace: default spec: accessModes: - ReadWriteMany resources: requests: storage: 5Gi # The size of the storage claim. storageClassName: "" selector: matchLabels: storage: "nfs" # The volume must have this label with this value.
-
Determine a
name
for the Persistent Volume Claim you want to create. -
Determine a
size
for your storage claim, but it must not exceed the Persistent Volume capacity. In the example, the Persistent Volume we use has 5Gi. -
Configure the
matchLabels
field, it must contain the labels of the Persistent Volume.
-
-
After configuration, apply the PVC to request the NFS Volume.
kubectl apply -f nfs-share.yaml
-
You should receive a return value of
persistentvolumeclaim/nfs-share created
. After the PVC is deployed, validate the status isPending
.kubectl get pv nfs-share
Your Persistent Volume Claim is Pending
because no workload has claimed it.
Related Information
For information on related topics or procedures, refer to the following: