liveBook · Manning

Nfs volume

As explained in Acing the Certified Kubernetes Administrator Exam, Second Edition

An NFS volume is a Kubernetes volume type that mounts a share from an NFS server for pod access.

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

How Acing the Certified Kubernetes Administrator Exam, Second Edition covers it

How deep it goes
Explains PV, PVC, pod manifests, access modes, mount options, and server prerequisites, but does not detail NFS server administration.
Examples
Uses an NFS PV, ReadWriteMany PVC, and nginx pod mounting shared content at /usr/share/nginx/html.
What it assumes
Assumes Kubernetes PV, PVC, pod, and volume-mount basics, while supplying the required NFS server address and path.
What you can do after
Builds an NFS-backed PV, binds a PVC, mounts it into a pod, and recognizes server-availability failures.
How it connects
Connects persistent volumes, persistent volume claims, pods, Deployments, access modes, and network file systems.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Acing the Certified Kubernetes Administrator Exam, Second Edition. The section links point to the parts of the book it draws on.