NFS Server Provisioner
The NFS client provisioner - https://github.com/kubernetes-incubator/external-storage/tree/master/nfs-client is an automatic provisioner for Kubernetes that uses your already configured NFS server, automatically creating Persistent Volumes.
This chart will deploy the Kubernetes nfs provisioner. This provisioner is intended for connecting to a pre-existing NFS server, and not includes a built in NFS server. If you want a built in NFS Server, please consider using the nfs-client-provisioner - https://github.com/helm/charts/tree/master/stable/nfs-client-provisioner instead.
This article is about how to use Helm to install nfs-client-provisioner on Kubernetes (K8S).
Kubernetes (K8s) is an open-source system for automating deployment, scaling, and management of containerized applications.
Helm is the best way to find, share, and use software built for Kubernetes.
NFS packages and rpcbind.service
A Network File System (NFS) allows remote hosts to mount file systems over a network and interact with those file systems as though they are mounted locally.
The rpcbind service uses TCP wrappers for access control, and access control rules for rpcbind affect all RPC-based services(Such as NFS).
Install NFS utils.
sudo yum install nfs-utils -y
Start and enable rpcbind.service
sudo systemctl start rpcbind && sudo systemctl enable rpcbind
Start and enable rpc-statd.service
sudo systemctl start rpc-statd && sudo systemctl enable rpc-statd
Pre-existing NFS server
You must have a pre-existing NFS server installed according to NFS Server and Client Installation on CentOS 7 - https://www.howtoforge.com/nfs-server-and-client-on-centos-7, or use which is provided by the third-party vendors(such as  File Storage NAS: Reliable Network Attached Storage - Alibaba Cloud - https://www.alibabacloud.com/product/nas).
Helm install nfs-client-provisioner into nfs-client-provisioner or your other namespace.
See Helm release about nfs-client-provisioner
helm list --namespace nfs-client-provisioner
See pods about nfs-client-provisioner.
kubectl get pods -n nfs-client-provisioner
Edit values.yaml and replace content within
Then, check the StorageClass status.
kubectl get sc
Dynamically Provision PersistentVolume
Since v1.9. Users now can and should instead use the
storageClassName field of the
PersistentVolumeClaim object. The value of this field must match the name of a StorageClass configured by the administrator (see below).
To select the “fast” storage class, for example, a user would create the following PersistentVolumeClaim:
kubectl get pvc
The following is a example about nfs-server-provisioner dynamically provision a PersistentVolume to the Deployment.
Apply nginx-deployment.yaml to create the Deployment.
kubectl apply -f nginx-deploymentyaml
Check Nginx Deployment.
kubectl get pods
Then, the Pod of the Deployment will mount a Volume from nfs-client-provisioner.
rpcbind service not start
if the nfs packages is not install or
rpcbind.service is not started, the Pod can not mount pv with error(such as
Unable to attach or mount volumes: unmounted volumes=[storage], unattached volumes=[config storage nginx-deployment-token-fr5t7]: timed out waiting for the condition) .
You need to install nfs packages, then start and enable
Uninstalling the Chart
To uninstall/delete the my-release deployment:
helm delete nfs-client-provisioner
The command removes all the Kubernetes components associated with the chart and deletes the release.