NFS storage class

Contents

In this section we show how you can setup a storage class that supports ReadWriteMany using NFS. NOTE: Running an NFS server on GKE k8s cluster with autopilot mode is not possible due to security restrictions. The NFS server provisioner requires two capabilities 'DAC_READ_SEARCH' and 'SYS_RESOURCE', which are disabled by Autopilot.

Prerequisites

Kubernetes

A running Kubernetes cluster.

Kubectl

Is the Kubernetes command-line tool, kubectl, allows you to run commands against Kubernetes clusters. Download it here.

Helm

Is a package manager for Kubernetes. Download it here.

Using an existing NFS server

If you have a NFS server, we will just create a client that uses that. Read more about this provisioner on github.

Add helm repository

$ helm repo add nfs https://kubernetes-sigs.github.io/nfs-subdir-external-provisioner/

"nfs" has been added to your repositories
$ helm repo update

Hang tight while we grab the latest from your chart repositories...
...Successfully got an update from the "nfs" chart repository
Update Complete. ⎈Happy Helming!⎈

Install client provisioner

Change nfs.server and nfs.path to reflect your setup.
$ helm upgrade --install \
    --namespace kube-system \
    --set nfs.server=?.?.?.? \
    --set nfs.path=/some/exported/path \
    --set storageClass.name=nfs \
    --set storageClass.archiveOnDelete=false \
    --set storageClass.allowVolumeExpansion=true \
    --version 3.0.0 \
    nfs-client \
    nfs/nfs-subdir-external-provisioner

Release "nfs-client" does not exist. Installing it now.
NAME: nfs-client
LAST DEPLOYED: Thu Feb 18 16:37:40 2021
NAMESPACE: kube-system
STATUS: deployed
REVISION: 1
TEST SUITE: None

Create NFS server in K8s cluster

Add helm repository

As of this writing, the helm community is slowly phasing out the stable channel. The new version of this provisioner does not have its own helm repo yet.
$ helm repo add stable https://charts.helm.sh/stable

"stable" has been added to your repositories
$ helm repo update

Hang tight while we grab the latest from your chart repositories...
...Successfully got an update from the "stable" chart repository
Update Complete. ⎈Happy Helming!⎈

Install server provisioner

You might want to update persistence.size for more capacity.
$ helm upgrade --install \
    --namespace kube-system \
    --set persistence.enabled=true \
    --set persistence.size=1Gi \
    --set storageClass.name=nfs \
    --set storageClass.allowVolumeExpansion=true \
    --version 1.1.3 \
    nfs-server \
    stable/nfs-server-provisioner

Release "nfs-server" does not exist. Installing it now.
WARNING: This chart is deprecated
NAME: nfs-server
LAST DEPLOYED: Thu Feb 18 16:41:20 2021
NAMESPACE: kube-system
STATUS: deployed
REVISION: 1
TEST SUITE: None
NOTES:
The NFS Provisioner service has now been installed.

Contents

Contents

AI-powered search

Juke AI