We talked about one of the most common methods of using an NFS Server to store data from our apps in the Kubernetes cluster.

One of the drawbacks of that method is the necessity of manually configure the folder mappings in each node before creating the Persistent Volumes. It’s tedious and sometimes more complicated to manage than it should

This article will show a second way to connect to an NFS Server, only via Persistent Volumes configuration.

General Notes

Article Series

This article is part of a series about Kubernetes using NFS Server as a source for persistent volumes. Here is the list of articles of this series:

  1. Configuring the NFS Server
  2. Method 1 — Mapping NFS drive to a local folder into each node
  3. Method 2 — Connecting directly to the NFS server via persistent volume configuration (this one)
  4. Creating a storage class to create a persistent volume via claims automatically.

Source Code

All the files used in this article are published in this GitHub repository: https://github.com/fabiofernandesx/k8s-volumes. Feel free to clone it or even open a pull request if you find something that needs to be fixed or added.

Home Lab

For this article series, I’ll use my raspberry pi Kubernetes cluster, but the commands should work in any environment, including cloud or virtual machines. If you are interested in seeing how to create a raspberry pi k8s cluster, you can find it here: Yet Another Raspberry Pi k8’s Cluster, or if you interested in how to create this cluster using the virtual box, you can see this one: Preparing Virtual Box VM’s to run Kubernetes.

#cluster #nfs-server #kubernetes

How to use NFS in Kubernetes Cluster
1.30 GEEK