NFS storage class
Contents
In this section we show how you can setup a ReadWriteMany
storage class using NFS.
GKE (Google) Autopilot clusters do not support running NFS 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.
- Helm
-
Is a package manager for Kubernetes.
Alt A) Create NFS server in your K8s cluster
Add helm repository
$ helm repo add nfs-server-and-external-provisioner https://kubernetes-sigs.github.io/nfs-ganesha-server-and-external-provisioner/
"nfs-server-and-external-provisioner" 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-server-and-external-provisioner" 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=10Gi \
--set storageClass.name=nfs \
--set storageClass.allowVolumeExpansion=true \
--version 1.8.0 \
nfs-server-and-external-provisioner \
nfs-server-and-external-provisioner/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.
Alt. B) Using an existing NFS server
If you already have an NFS server, we can create a client that uses that. Read more about this provisioner on github.
Add helm repository
$ helm repo add nfs-external-provisioner https://kubernetes-sigs.github.io/nfs-subdir-external-provisioner/
"nfs-external-provisioner" 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-external-provisioner" 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 4.0.18 \
nfs-client \
nfs-external-provisioner/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