Kubernetes and Cloud Native Associate (KCNA)Kubernetes FundamentalsMedium

A developer is configuring a Pod that needs to access files from a shared network storage system, specifically an NFS (Network File System) share. Which type of Kubernetes Volume should be used to mount this NFS share into the Pod?

  1. Anfs
  2. BhostPath
  3. CpersistentVolumeClaim
  4. DemptyDir
Show answer & explanation

Correct answer: A. nfs

The `nfs` volume type in Kubernetes is specifically designed to mount an existing NFS share into a Pod. It requires the NFS server address and the path to the share.

Why the other options are wrong

  • B. `hostPath` mounts a file or directory from the node's filesystem, not a network share.
  • C. `persistentVolumeClaim` is a request for abstract storage, which could be backed by NFS, but `nfs` is the direct volume type if the NFS details are known at the Pod level.
  • D. `emptyDir` provides ephemeral storage tied to the Pod's lifecycle, not external shared storage.

Kubernetes `nfs` Volume

The `nfs` volume type in Kubernetes allows a Pod to mount an existing NFS (Network File System) share, providing shared network storage that can be accessed by multiple Pods.

  • Mounts an NFS share directly.
  • Requires NFS server address and path.
  • Can be shared between multiple Pods.
  • Data persists independently of Pod lifecycle.

Memory trick: NFS is for 'Networked File System' sharing.

More Kubernetes Fundamentals questions