Default Storageclass with QNAP

Updated 2020-09-20

The goal is to configure a default storage class for pods running in my k8s home lab.

Below are the steps I used. I’m not a big fan of using the default namespace so I modified as appropriate.

Each of the worker nodes must have the nfs-common package installed.

#install nfs-common on all worker nodes 
sudo apt-get install -y nfs-common

Run the below on the master node,

#clone repo
git clone
cd nfs-provisioning

kubectl create ns nfs

#change the namespace from default to nfs
vi rbac.yaml

kubectl create -f rbac.yaml -n nfs

#change the provisioner name to
#provisioner: dev.home.lab/nfs
vi default-sc.yaml

kubectl apply -f default-sc.yaml -n nfs

#Change the below items with your own values
#            - name: PROVISIONER_NAME
#              value: dev.home.lab/nfs
#            - name: NFS_SERVER
#              value:
#            - name: NFS_PATH
#              value: /share/CACHEDEV4_DATA/default-sc
#            server:
#            path: /share/CACHEDEV4_DATA/default-sc
vi deployment.yaml 

kubectl apply -f deployment.yaml -n nfs && kubectl get po -n nfs -w

To test this default storage class execute the below;

cp 4-pvc-nfs.yaml 4-pvc-nfs-1.yaml

#delete the line 
# storageClassName: managed-nfs-storage
vi 4-pvc-nfs-1.yaml

kubectl create -f 4-pvc-nfs-1.yaml

kubectl get pvc

By deleting storageClassName: managed-nfs-storage from the yaml file, Kubernetes will use the storageclass defined as default.


Looking at the FileStation interface for the QNAP, we can see the newly created folder. (I had the current context namespace set to jx when I created the pvc. That is why we see jx-pvc1-... as the prefix.)


Helm Chart
Dynamic NFS
How to use the ‘storageClass’ attribute Deploy dynamic NFS provisioning