Skip to content

ReadWriteMany volumes using an in-cluster NFS server

Estimated time to read: 2 minutes

This tutorial will guide you through the installation of the NFS Server Provisioner using Helm with a basic configuration.

What is NFS Server Provisioner?

NFS Server Provisioner is a provisioner for Kubernetes. It allows you to quickly and easily deploy shared storage that works almost anywhere. This chart deploys the Kubernetes external-storage projects nfs provisioner, which includes a built-in NFS server.

Prerequisites

  • A running Kubernetes cluster.
  • Helm installed on your local machine.

Step-by-Step Installation

1. Add the Helm Repository

First, you need to add the NFS Ganesha Server and External Provisioner Helm repository:

helm repo add nfs-ganesha-server-and-external-provisioner https://kubernetes-sigs.github.io/nfs-ganesha-server-and-external-provisioner/

2. Install the Chart

Warning: The default configuration will not provide persistent storage for data stored on the dynamic volumes provisioned by this chart. Follow the instructions below carefully!

To ensure data persistence for your NFS server and subsequent NFS volumes, you will need to configure the NFS server with a persistent volume from Cyso Cloud. Save the example below as values.yaml:

persistence:
  enabled: true
  size: 100Gi

Once saved, you can install the chart with the following command:

helm install nfs-server-provisioner nfs-ganesha-server-and-external-provisioner/nfs-server-provisioner -f values.yaml

This will automatically provision both the NFS server, and an NFS Storage Class in your cluster.

3. Creating ReadWriteMany volumes using the NFS server

Now that the NFS server and provisioner are installed, you can use them to create PersistentVolumeClaims like so:

apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: my-nfs-pvc
spec:
  accessModes:
  - ReadWriteMany
  resources:
    requests:
      storage: 10Gi
  storageClassName: nfs

This will create a PersistentVolumeClaim that can be used in scenarios where you need to read and write to a volume from multiple pods that can be located on different nodes. Underwater all data is still saved on a redundant volume from Cyso Cloud via the NFS server, ensuring integrity for your data.