Skip to main content Link Menu Expand (external link) Document Search Copy Copied

Installing PV

Created : 22/05/2032 | on Linux
Status: Draft

If you have already created a Storage Pool and a Volume, here are the next steps:

  1. Create an NFS Shared Folder on QNAP:

    • In the QTS Management Console, go to “Control Panel” > “Shared Folder”.
    • Click “Create” > “Shared Folder”.
    • Enter a folder name and description, then choose the volume that you just created.
    • Set the disk quota for the shared folder. For instance, to make 25TB available to Kubernetes, set this as the disk quota.
    • Click “Create”.
  2. Set Permissions for the NFS Shared Folder:

    • After creating the shared folder, click on “Access Permissions” in the folder’s options.
    • In the “Permission Type” dropdown, select “NFS Host Access”.
    • Enter the IP address or hostname of your Kubernetes nodes.
    • Set the “Access Right” to “No Limit”.
    • Click “Apply”.
  3. Enable NFS Service on QNAP:

    • In the QTS Management Console, go to “Control Panel” > “Network & File Services” > “Win/Mac/NFS”.
    • Go to the “NFS Service” tab and check “Enable NFS”.
    • Click “Apply”.
  4. Install NFS Client on Kubernetes Nodes:

    Install an NFS client on each of your Kubernetes nodes. If you’re using Ubuntu, you’d run:

    sudo apt update
    sudo apt install nfs-common
    
  5. Deploy NFS Provisioner to Kubernetes:

    Deploy the NFS-client provisioner in your Kubernetes cluster. This requires Helm to be installed. If you don’t have it, follow the instructions at https://helm.sh/docs/intro/install/ to install it.

    • Clone the nfs-subdir-external-provisioner repository:

      git clone https://github.com/kubernetes-sigs/nfs-subdir-external-provisioner.git
      
    • Deploy the NFS provisioner:

      cd nfs-subdir-external-provisioner/
      helm install nfs-subdir-external-provisioner ./charts/nfs-subdir-external-provisioner \
        --set nfs.server=<nfs_server_ip> \
        --set nfs.path=<path_to_your_nfs_root>
      

    Replace <nfs_server_ip> with the IP address of your QNAP NAS server and <path_to_your_nfs_root> with the path to the NFS share you created.

5.1. Create a default storageclass

when we create pvcs if a storage class is not specified the cluster will try to use a default storage class, the storage provisioner creates a storage class called nfs-client and we can make that the default storage class with the command.

  kubectl patch storageclass nfs-client -p '{"metadata": {"annotations":{"storageclass.kubernetes.io/is-default-class":"true"}}}'

with this all the new pvcs that don;t have a storage class mentioned will be allocated to the default storage class.

  1. Create PersistentVolumeClaims:

    You can now create PersistentVolumeClaims (PVCs) in your Kubernetes cluster. These PVCs will dynamically provision PersistentVolumes (PVs) using the NFS share on your QNAP NAS.

    Here’s an example PVC:

    apiVersion: v1
    kind: PersistentVolumeClaim
    metadata:
      name: my-pvc
    spec:
      accessModes:
        - ReadWriteOnce
      resources:
        requests:
          storage: 1Ti
    

Please replace placeholders in the commands with your actual values and adjust configurations according to your environment and security requirements.


Check the next topic


Click here to report Errors, make Suggestions or Comments!