An NFS volume mounts a network file-system share into a pod. Unlike node-local storage, the data remains available as pods move between nodes, and multiple pods can write to it simultaneously. section 7.1.1 section 7.1
Configure an NFS-backed workload through three Kubernetes objects:
- Define a PersistentVolume with an nfs.server, exported path, capacity, access mode, and any server-specific mountOptions. section 7.1.1
- Create a PersistentVolumeClaim using ReadWriteMany when several pods or sources must write concurrently; optionally select the PV with volumeName. section 7.1.1
- Mount the claim in a pod or Deployment by referencing the claim under volumes and attaching it with volumeMounts. section 7.1.1 section 7.1
NFS-backed web content
A PersistentVolume can point to server nfs-server.default.svc.cluster.local and path "/" with nfsvers=4.2. A matching ReadWriteMany claim named nfs-pvc selects nfs-pv, and an nginx pod mounts that claim at /usr/share/nginx/html.
apiVersion: v1
kind: PersistentVolume
metadata:
name: nfs-pv
spec:
capacity:
storage: 1Mi
accessModes:
- ReadWriteMany
nfs:
server: nfs-server.default.svc.cluster.local
path: "/"
mountOptions:
- nfsvers=4.2
Inspect the complete PersistentVolume manifest used to connect Kubernetes storage to an NFS server. section 7.1.1
Apply the manifests only when an NFS server is reachable; without a running server, the example pod fails to run. Exam prompts requiring NFS provide the server address and path. section 7.1.1
