Operations 5 min read

Practical Guide to Setting Up NFS Network File System for Kubernetes Volumes

This article explains the fundamentals of NFS (Network File System), its role in Kubernetes volumes, and provides a step‑by‑step tutorial for installing nfs-utils, configuring /etc/exports, setting permissions, starting rpcbind and NFS services, and verifying the setup with commands.

Practical DevOps Architecture
Practical DevOps Architecture
Practical DevOps Architecture
Practical Guide to Setting Up NFS Network File System for Kubernetes Volumes

Introduction: Practical guide to building an NFS network file system for data storage.

1. What is NFS (Network File System)

NFS is a network file system protocol based on TCP/IP; using NFS you can access remote server shared resources as if they were local directories.

NFS service implementation relies on the RPC (Remote Procedure Call) mechanism to map remote resources to the local system.

Typically you need to install the nfs-utils and rpcbind packages; nfs-utils provides NFS sharing and access, while rpcbind supplies RPC support.

It uses TCP/IP for file transfer, making it suitable for LAN environments and easy to operate.

Default ports: NFS uses port 2049 , RPC uses port 111 .

2. Role of NFS in Kubernetes Volumes

When a node fails, its Pods are rescheduled; to prevent data loss during this migration, an external network file system such as NFS (or an object storage system) is required to retain data.

3. Deploying an NFS Server

(1) Install nfs-utils (required on all nodes, but not started automatically)

yum install nfs-utils -y

Create a directory for the NFS share (customizable):

mkdir /data/nfs

Grant permissions to the directory:

chmod 777 /data/nfs

(2) Edit the /etc/exports configuration file

vim /etc/exports

Add an export line exposing the directory to the desired network segment:

/data/nfs 192.168.210.0/24(rw,insecure,sync)

(3) Parameter explanations

rw – shared directory is readable and writable.

secure – restricts clients to connect from ports < 1024.

insecure – allows clients to connect from ports > 1024.

sync – forces data to be written synchronously to memory buffers and disk, ensuring consistency at the cost of performance.

async – writes data to memory buffers first and flushes to disk later, improving performance but risking data loss on crash.

(4) Start rpcbind (installed automatically with nfs-utils) and the NFS service

systemctl start rpcbind

systemctl start nfs

(5) Verify the NFS export

showmount -e 192.168.210.10

--- End of tutorial ---

OperationsKubernetesLinuxStorageNFSNetwork File System
Practical DevOps Architecture
Written by

Practical DevOps Architecture

Hands‑on DevOps operations using Docker, K8s, Jenkins, and Ansible—empowering ops professionals to grow together through sharing, discussion, knowledge consolidation, and continuous improvement.

0 followers
Reader feedback

How this landed with the community

login Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.