Kubernetes: Dynamic NFS-Client Provisioner
1 min readSep 17, 2019
If you have already setup your NFS server, you can use Dynamic NFS-Client Provisioner , to automatically provision Persistent Volume when you deploy your Persistent Volume Claim. In other words, you don’t have to create your
The easiest way to install it is using Helm.
helm install stable/nfs-client-provisioner --set nfs.server=<nfs-server-ip-address> --set nfs.path=<nfs-server-sharedfolder-path>
One hiccup that I faced is the command above return:
Error: no available release name found
The solution:
kubectl create serviceaccount --namespace kube-system tillerkubectl create clusterrolebinding tiller-cluster-rule --clusterrole=cluster-admin --serviceaccount=kube-system:tillerkubectl patch deploy --namespace kube-system tiller-deploy -p '{"spec":{"template":{"spec":{"serviceAccount":"tiller"}}}}'
Now you can test it out, by creating PVC. We expect the PV will be automatically dynamically created.
testpvc.yamlkind: PersistentVolumeClaim
apiVersion: v1
metadata:
name: test-claim
annotations:
volume.beta.kubernetes.io/storage-class: “nfs-client”
spec:
accessModes:
— ReadWriteMany
resources:
requests:
storage: 1Mi
Create the PVC:
kubectl create -f testpvc.yaml
That’s all folks!