Skip to content

About

No description, website, or topics provided.

Resources

Stars

72 stars

Watchers

8 watching

Forks

Latest commit

 

History

92 Commits

Folders and files

Repository files navigation

QNAP CSI Driver for Kubernetes

This is the official Container Storage Interface (CSI) driver for QNAP NAS devices.

Table of Contents

Introduction

The QNAP CSI driver is a storage service designed to provide volumes from local or remote NAS devices to Kubernetes. It is based on NetApp Trident, providing dynamic volume provisioning. The driver supports quality of service (QoS) assignment to ensure optimal performance tailored to application needs.

The key concepts in this driver are backend and pools. A backend represents the NAS storage used for PersistentVolumeClaim (PVC) requests. Each backend contains virtual pools, which are logical groupings of storage that dynamically select an appropriate physical pool based on specific requirements. PVCs request storage through a StorageClass, which binds to the virtual pool, ensuring the volume is created from the correct physical resources. The process for creating a volume using this driver is as follows (also illustrated in Figure 1):

  1. The user claims a PVC request specifying a StorageClass.
  2. The system binds the request to a suitable virtual pool configured in the backend.
  3. The system filters the available physical pools based on the required features.
  4. A suitable physical pool is selected from the filtered options.
  5. The requested volume is created on the selected physical pool.

Tip

The system prioritizes selecting the backend with the lowest current volume usage to ensure load balancing.

create.png Figure 1. Process of creating a volume with the QNAP CSI driver.

Software Prerequisites

CSI Driver Version and Compatibility

Driver Version Supported Kubernetes Versions Supported QNAP NAS Operating Systems
v1.6.3 v1.24 to v1.35 QTS 5.1.0 or later (including QTS 6.0)
QuTS hero h5.1.0 or later (including QuTS hero h6.0.0)

Supported Host Operating Systems

  • Debian 8 or later
  • Ubuntu 16.04 or later
  • CentOS 7.0 or later
  • RHEL 7.0 or later
  • CoreOS 1353.8.0 or later
  • Talos 1.8 or later

Supported Platforms

  • AMD64
  • ARM64 and ARMv7

Supported Features

  • Protocol: iSCSI, SMB
  • High Availability: iSCSI Multipath support
  • Security: iSCSI CHAP Authentication
  • Access mode: ReadWriteOnce, ReadWriteMany
  • Data Services: Snapshots, Cloning, Expansion
  • Pool level: RAID levels, SSD cache, Tiering
  • Optimization: Thin Provisioning, Deduplication, Compression, Thresholds

Note

QuTS hero high availability clusters: Synchronization between the active and passive nodes is managed by the high availability service on the NAS. A PVC operation completes once the active node has processed the request, and the NAS then synchronizes the volume to the passive node. To confirm that new, cloned, or restored volumes are protected, check the high availability cluster status in the High Availability Manager QPKG.

Installation

Preinstallation Checklist

  • Ensure that both the Kubernetes and the QNAP NAS operating system versions are supported.

Note

  • Minikube is not supported.
  • On Rancher-managed clusters, the driver auto-detects the Rancher environment and completes all Rancher-specific tasks automatically.
  • If you plan to use the iSCSI protocol, you must install the required iSCSI utilities on all Kubernetes master and worker nodes. You can choose to use a single-path iSCSI setup for basic connectivity, or a multipath iSCSI setup if you require path redundancy, load balancing, or improved performance.

    • Single-Path iSCSI Setup

      sudo apt install open-iscsi 
      

      [!NOTE] Use this setup when the backend declares at most one interface in networkInterfaces.

      The driver decides whether an iSCSI volume needs a multipath device by checking whether the multipath command is available on the node. If it is, every iSCSI volume must have a multipath device before it can be mounted. At its default setting, multipathd does not create a multipath device for a LUN with only one path, so the volume may fail to mount.

      Several Linux distributions install multipath tooling as part of a default or recommended package set, so check each worker node even if you never configured multipath:

      command -v multipath
      

      If the command prints a path, we recommend one of the following:

      • Remove the multipath tooling (recommended for single-path nodes):
      sudo apt remove multipath-tools          # Debian / Ubuntu
      sudo yum remove device-mapper-multipath  # CentOS / RHEL
      
      • Or keep it and set find_multipaths no in /etc/multipath.conf, then restart multipathd, as described in the Multipath iSCSI Setup below. Note that this setting applies to the whole host.

      Stopping or disabling the multipathd service alone is not enough, because the multipath command remains available after the service is stopped.

    • Multipath iSCSI Setup Install the required packages

      sudo apt-get install -y open-iscsi lsscsi sg3-utils multipath-tools scsitools
      

      Set scanning to manual

      sudo sed -i 's/^\(node.session.scan\).*/\1 = manual/' /etc/iscsi/iscsid.conf
      

      Create or edit the multipath configuration file

      sudo tee /etc/multipath.conf <<-EOF
      defaults {
          user_friendly_names yes
          find_multipaths no
      }
      devices {
          device {
              vendor "QNAP"
              product "iSCSI Storage"
              fast_io_fail_tmo 120
              no_path_retry queue
          }
      }
      EOF
      

      [!NOTE] Ensure that /etc/multipath.conf contains find_multipaths no under defaults. At its default setting, multipathd does not create a multipath device for a LUN that has only one path, which prevents the volume from mounting.

      find_multipaths no applies to the whole host, not only to QNAP volumes. multipathd will claim every single-path block device on the node, including local disks. Apply it only on nodes intended for multipath iSCSI workloads.

      The devices section applies only to QNAP LUNs. multipathd overrides the iSCSI timeout set by the CSI driver (replacementTimeout in the StorageClass) with its own fast_io_fail_tmo, which defaults to 5 seconds. With the default, a short network outage or a NAS high availability switchover can turn the filesystem read-only. Keep fast_io_fail_tmo equal to or greater than replacementTimeout.

      Enable and start the multipath service

      sudo systemctl enable --now multipath-tools.service
      sudo service multipath-tools restart
      

      Verify that both services are active

      sudo systemctl status multipath-tools
      sudo systemctl status open-iscsi
      
  • Verify that your NAS has at least one available storage pool and iSCSI service is enabled.

    • To check storage pools on your NAS, open Storage & Snapshots and navigate to "Storage > Storage/Snapshots".
    • If the iSCSI protocol is utilized. To check iSCSI service on your NAS, open iSCSI & Fibre Channel and verify that the "Service" toggle switch is on.
Verify your Kubernetes cluster.

Verifying Your Kubernetes Cluster

  • Make sure kubectl is installed and working.

    kubectl get pods -A
    
    kubectl version 
    

    Verify that both commands return expected results without errors.

  • Make sure that you are logged in as a Kubernetes cluster administrator.

    kubectl auth can-i '*' '*' --all-namespaces 
    

    The command should return yes.

  • Verify that you can launch a pod using an image from Docker Hub and check connectivity to the storage system over the pod network.

    kubectl run -i --tty ping --image=busybox --restart=Never --rm -- \ping <NAS management IP> 
    

    For example: kubectl run -i --tty ping --image=busybox --restart=Never --rm -- \ping 8.8.8.8
    A successful test will display packet responses, indicating connectivity. The pod will automatically delete itself after completion.

Install the QNAP CSI Plugin

  1. Clone the git repository.

    sudo git clone https://github.com/qnap-dev/QNAP-CSI-PlugIn.git 
    
  2. Navigate to the directory.

    cd QNAP-CSI-PlugIn 
    
  3. Choose one of the following installation methods.

    • Installing via kubectl

      Execute the following commands in order:

      kubectl apply -f Deploy/Trident/namespace.yaml 
      
      kubectl apply -f Deploy/crds/tridentorchestrator_crd.yaml 
      
      kubectl apply -f Deploy/Trident/bundle.yaml 
      
      kubectl apply -f Deploy/Trident/tridentorchestrator.yaml 
      
    • Installing via Kustomize

      Execute the following commands in order:

      kubectl apply -k Deploy/crds 
      
      kubectl apply -k Deploy/Trident 
      
    • Installing via Helm

      1. Install Helm.

        Please refer to the Helm Installation Guide for instructions.

      2. Install the CSI plugin.

        helm install qnap-trident ./Helm/trident -n trident --create-namespace 
        
      3. Upgrade the plugin.

        helm upgrade qnap-trident Helm/trident/ -n trident
        

Install VolumeSnapshot (Optional)

A VolumeSnapshot is required to take snapshots.

kubectl apply -k VolumeSnapshot 

Check that Trident is Ready

  1. Check the status of Trident.

    kubectl get deployment -n trident 
    

    The output should display both trident-controller and trident-operator as being ready.
    Example output: trident-ready.png

  2. Verify the Trident service.

    kubectl get service -n trident 
    

    The output should include trident-csi.
    Example output: trident-ready2.png

CSI Driver Configuration

To ensure the CSI driver functions correctly, it is important to configure the backend, secert (Optional), StorageClass, and PVC with matching labels and parameters to enable proper binding. The backend defines the virtual storage pools and connects the underlying physical resources, the secret is required when the Samba protocol is utilized for connection, while the StorageClass specifies the QoS that the PVC will request.

For binding to succeed, the PVC must reference a StorageClass that has the correct labels and selectors, which correspond to the virtual pools defined in the backend. Accurate configuration of names, labels, and selectors in each component is essential to ensure the PVC is correctly bound to the appropriate storage resources through the backend and StorageClass.

Warning

Avoid modifying CSI-provisioned resources directly through the UI. Changes made outside the CSI workflow may cause configuration mismatches between components and lead to unexpected behavior. In particular, do not map additional LUNs to an iSCSI target created by the CSI driver. The driver assumes one LUN per target and will not map a volume to a target that already has another LUN.

Backend

There are two methods for configuring the backend:

  • Custom resource (TridentBackendConfig)
  • CLI (tridentctl).

Tip

We recommend using the newer custom resource method over the legacy CLI method.

  1. Create or edit a YAML file (for the custom resource method) or a JSON file (for the CLI method).
    Please refer to the following examples.

    • Custom resource method
      Example: Samples/Backend/backend-sample.yaml

      apiVersion: v1
      kind: Secret
      metadata:
        name: backend-qts-secret # Required. Name your secret.
        namespace: trident
      type: Opaque
      stringData:
        username: user # Required. Your NAS username.
        password: "0000" # Required. Your NAS password.
        chapInitiatorUsername: <initiator_username> # Optional. Username used by the initiator to authenticate to the target.
        chapInitiatorPassword: <initiator_password> # Optional. Password for the initiator’s CHAP authentication. 
        chapTargetUsername: <target_username> # Optional. Username used by the target to authenticate back to the initiator (for mutual CHAP).
        chapTargetPassword: <target_password> # Optional. Password for the target’s CHAP authentication (for mutual CHAP). 
        storageAddress: "0.0.0.0" # Required. Your NAS IP address. On a QuTS hero high availability cluster, use the cluster IP.
        https: "false" # Optional. Whether to enable a secure connection. Default: False.
        port: "8080" # Optional. Specify the port. Default: 8080.
        trustedCACertificate: <Base64-encoded-trusted-ca-certificate-for-backend> # Optional. Base64-encoded value of trusted CA certificate. Used for certificate-based authentication. 
      ---
      apiVersion: trident.qnap.io/v1
      kind: TridentBackendConfig
      metadata:
        name: backend-qts # Required. Name your backend in Kubernetes.
        namespace: trident
      spec:
        version: 1
        storageDriverName: qnap-nas #Required. Support 'qnap-nas'(latest) or 'qnap-iscsi'
        backendName: qts # Required. Name your backend in QNAP CSI.
        networkInterfaces: ["Adapter1"] # Optional. Your adapter name or leave it empty. Do not set it on a QuTS hero high availability cluster.
        useCHAP: true # Optional. Enables CHAP authentication for iSCSI connections.
        credentials:
          name: backend-qts-secret # Required. Enter the secret name set in metadata.name.
        debugTraceFlags:
          method: true
        storage: # Required. Define one or more virtual pools.
          - serviceLevel: pool1 # Required. Name your virtual pool.
            labels: # Required. Define custom labels for your virtual pool.
              performance: performance1
            features: # Optional. Define features for your virtual pool.
              tiering: Enable
          - serviceLevel: pool2
            labels:
              performance: performance2
            features:
              tiering: Enable
              ssdCache: "true"
              raidLevel: "1"
    • CLI method
      Example: Samples/Backend/backend-sample.json.

      {
          "version": 1,
          "storageDriverName": "qnap-nas",
          "backendName": "qts",
          "storageAddress": "0.0.0.0",
          "username": "user",
          "password": "0000",
          "chapInitiatorUsername": "<initiator_username>",
          "chapInitiatorPassword": "<initiator_password>",
          "chapTargetUsername": "<target_username>",
          "chapTargetPassword": "<target_password>", 
          "https": "false",
          "port": "8080",
          "trustedCACertificate": "<Base64-encoded-trusted-ca-certificate-for-backend>",
          "networkInterfaces": ["Adapter1"],
          "useCHAP": "true",
          "debugTraceFlags": {"method": true},
          "storage": [
              {
                  "labels": {"performance": "performance1"},
                  "features":{
                      "tiering": "Enable"
                  },
                  "serviceLevel": "pool1"
              },
              {
                  "labels": {"performance": "performance2"},
                  "features":{
                      "tiering": "Enable",
                      "ssdCache": "true",
                      "raidLevel": "1"
                  },
                  "serviceLevel": "pool2"
              }
          ]
      }

Note

When a backend is registered, the driver automatically detects the operating system version of each NAS target and adapts its behavior accordingly. The version is always read from the NAS itself and cannot be declared through the backend configuration, a StorageClass, a ConfigMap, a Secret, or an environment variable.
If the version cannot be determined, the backend fails to register: it enters the Failed state and exposes no storage pools, so any PVC that resolves to it stays pending. Run the following command to check the backend state and the reported error.

./<your tridentctl path> get backend -n trident
  1. In the YAML or JSON file, configure the following based on your NAS settings and usage requirements.
    • Specify the correct NAS user, password, and IP address.

    • Optionally, use the useCHAP field to enable CHAP authentication. Providing both Initiator and Target credentials in the Secret enables mutual CHAP. For one-way CHAP, set only the Initiator credentials.

    • Optionally enable HTTPS and configure the service port and trusted CA certificate according to your requirements.

    • Name the secret and backend.

    • Optional: Set the network portal in the networkInterfaces field.

      [!Note] Network settings support physical and virtual adapters. In the networkInterfaces field, assign one or multiple interface names (e.g., ["Adapter1", "Adapter2"]), or leave it empty to default to storageAddress. To view the available adapters on your NAS, open Network & Virtual Switch and go to "Interfaces".
      The number of interfaces determines the node setup. With zero or one interface, the volume has a single iSCSI path; follow the Single-Path iSCSI Setup in Installation.
      If you plan to use multipath, consider the following requirements:

      • Configure multipath on your Kubernetes nodes. (Refer to Installation)
      • Specify more than one interface in networkInterfacesto enable redundant paths.
      • Use interfaces on different subnets or uplinks to improve availability and, when supported by the workload and OS policies, achieve better path distribution.

      Multipath enhances reliability by providing multiple independent I/O paths. Its performance benefits depend on proper network topology, path separation, and node-side configuration.

      [!IMPORTANT] QuTS hero high availability clusters: Set storageAddress to the cluster IP and leave networkInterfaces unset.

      • Adapter names can differ between the two NAS nodes, so the same networkInterfaces value may not match on the other node.
      • A node's own IP address stays with that node when the cluster switches over or fails over, so iSCSI sessions that use it stop working. The cluster IP always moves to the active node.

      Without networkInterfaces, each volume uses a single iSCSI path through the cluster IP. Follow the Single-Path iSCSI Setup in Installation.

    • Define the virtual pools based on your usage requirements.

      Field Description Example
      serviceLevel Name the virtual pool. serviceLevel: pool1
      labels Label the virtual pool with any key/value. usage: test
      features Define the virtual pool with the specified features from the feature list below. features:
        ssdCache: "true"

      Feature list:

      Feature Description Value Note
      raidLevel Combines multiple disks to improve both redundancy and performance. 0, 1, 5, 6, etc.
      ssdCache Boosts NAS performance by caching frequently accessed data on SSDs, reducing latency and speeding up access. true, false
      tiering Moves hot data to high-performance drives and cold data to cost-efficient drives, optimizing performance and total cost of operation. enable, disable Only QTS

Secert

If the Samba protocol is utilized, the Secert configuration is required. Create or edit the YAML file Samples/Secret/smb_user_secret.yaml
Example:

apiVersion: v1
kind: Secret
metadata:
    name: qts-csi-smb #Required. Name your secert for Samba.
    namespace: trident
type: Opaque
stringData:
    username: user1 #Required. The valid Samba username on the NAS.
    password: 0000 #Required. The valid Samba password on the NAS.

StorageClass

  1. Create or edit the YAML file.

    iSCSI Protocol: Samples/StorageClass/sc_iscsi_sample.yaml.

    Example:

    apiVersion: storage.k8s.io/v1
    kind: StorageClass
    metadata:
      name: storageclass1 # Required. Name your storageclass.
    provisioner: csi.trident.qnap.io
    parameters:
      selector: "performance=performance1" # Required. Corresponds to the labels in the virtual pool.
      fsType: "ext4" # Optional. You can choose to enter ext4 (default), xfs, or ext3.
      replacementTimeout: '120' # Optional. Define the iSCSI timeout in seconds, with a default value of 120. On multipath nodes, set fast_io_fail_tmo in /etc/multipath.conf to the same value or greater.
    allowVolumeExpansion: true

    SMB Protocol: Samples/StorageClass/sc_smb_sample.yaml.

    Example:

    apiVersion: storage.k8s.io/v1
    kind: StorageClass
    metadata:
      name: storageclass1 # Required. Name your storageclass.
    provisioner: csi.trident.qnap.io
    parameters:
      selector: "performance=performance1" # Required. Corresponds to the labels in the virtual pool.
      trident.qnap.io/fileProtocol: "smb"        
      csi.storage.k8s.io/node-stage-secret-name: "qts-csi-smb" # Required. It must match the metadata.name in the Secret file.       
      csi.storage.k8s.io/node-stage-secret-namespace: "trident" # Required. It must match the metadata.namespace in the Secret file.  
    allowVolumeExpansion: true
  2. Configure the file based on your usage requirements.

    Bind the backend's virtual pool using the parameters.selector field, ensuring it matches the labels in the virtual pool.

Note

For the iSCSI protocol, when a volume is staged on a node, the CSI driver uses blkid to check whether the device already contains a filesystem. If no filesystem is present, the driver formats the device with the fsType defined in the StorageClass. If a filesystem already exists, the device is mounted as-is and no formatting is performed.

PVC

  1. Create or edit the YAML file Samples/Volumes/pvc-sample.yaml
    Example:

    kind: PersistentVolumeClaim
    apiVersion: v1
    metadata:
      name: pvc1
      annotations: # Required. Define features for your volume.
        trident.qnap.io/Threshold: "90"
        trident.qnap.io/ThinAllocate: "true"
    spec:
      accessModes:
        - ReadWriteOnce # Required. iSCSI: ReadWriteOnce, Samba: ReadWriteMany
      resources:
        requests:
          storage: 10Gi # Required. Specify your resource size.
      storageClassName: storageclass1 # Required. Corresponds to the StorageClass name.
  2. Configure the file based on your usage requirements.

    • Bind the StorageClass using the storageClassName field.

    • Set your volume feature requirements in the annotations field using the prefix trident.qnap.io/. For example, trident.qnap.io/Threshold: "90". Annotation names are case-sensitive; enter them exactly as listed in the following table.

      Volume features:

      Feature Description Value Note
      Threshold Monitors storage usage to trigger alerts when capacity limits are reached, preventing overuse. 0-100
      ThinAllocate Dynamically allocates storage space to meet demands, optimizing usage and avoiding shortages. true, false
      IoSyncMode Sets the I/O synchronization behavior of the volume. default, sync, async iSCSI protocol only. Refer to the note below.
      SharedFolderRecycleBin Enable or disable the Recycle Bin based on your needs. true, false SMB protocol only
      Compression Compresses files to reduce size, saving space and allowing more storage on the NAS. true, false Only QuTS hero
      Deduplication Eliminates duplicate data to reduce storage needs and minimize network data transfers. true, false Only QuTS hero
      FastClone Creates file copies faster to save space by sharing data blocks between originals and copies. true, false Only QuTS hero
      importOriginalName The original volume name. string Refer to Importing a PVC in the "Operations" section.
      importBackendName The imported backend name. string Refer to Importing a PVC in the "Operations" section.

Note

IoSyncMode is applied only when the volume is created, and the resulting setting depends on the operating system of the target NAS.

IoSyncMode QTS earlier than 6.0 QTS 6.0 or later QuTS hero
default AsyncIO disabled Synchronous by design. No configuration is required. ZIL synchronized I/O mode: Auto
sync AsyncIO disabled Synchronous by design. No configuration is required. ZIL synchronized I/O mode: Always
async AsyncIO enabled Not supported. Volume creation fails. ZIL synchronized I/O mode: None

Also note the following:

  • The annotation name is case-sensitive: trident.qnap.io/IoSyncMode. Any value other than default, sync, or async causes volume creation to fail.
  • Editing or removing the annotation after the PVC is bound does not change the setting of the existing volume.
  • This feature is configured on the PVC only. The StorageClass does not provide an equivalent parameter.

Deployment

When building the service, add the backend, the StorageClass, and then the PVC, in this order.

1. Add a Backend

Make sure you have a corresponding pool, and based on the type of your backend configuration file, choose one of the following methods to add the pool.

  • Using the custom resource method to add a backend with the YAML file

    a. Add a backend based on the YAML file you configured earlier.

    kubectl apply -f <your backend yaml file path>
    

    For example: kubectl apply -f Samples/Backend/backend-sample.yaml

    b. Check the result.

    kubectl get tridentbackendconfig -n trident
    
  • Using the CLI method to add a backend with the JSON file

    a. Ensure you have permission to execute tridentctl.

    chmod u+x tridentctl 
    

    b. Add a backend based on the JSON file you configured earlier.

    ./<your tridentctl path> create backend -f <backend.json> -n trident 
    

    For example: ./bin/linux-amd64/tridentctl create backend -f Samples/Backend/backend-sample.json -n trident

Note

If it takes over 30 seconds and shows the error "Command terminated with exit code 1" due to timeout, check your network connection and try again.

After adding the backend, check the result.

kubectl get pods -n trident 

2. Add a StorageClass

Execute the following command:

kubectl apply -f <your StorageClass yaml file path> 

For example: kubectl apply -f Samples/StorageClass/sc_iscsi_sample.yaml

Note

If you want to use the SMB protocol, please execute the following command and apply the corresponding Secret before adding the StorageClass.

kubectl apply -f <your Secret yaml file path> 

For example: kubectl apply -f Samples/Secret/smb_user_secret.yaml

3. Add a PVC

Execute the following command:

kubectl apply -f <your pvc yaml file path> 

For example: kubectl apply -f Samples/Volumes/pvc-sample.yaml

4. Verify the Connection (Optional)

After completing the deployment steps, verify if the connection is mapped in iSCSI & Fibre Channel on the NAS. You should locate the connection in the "iSCSI Target List" on the "iSCSI Storage" page, as shown in the red frame in Figure 2.

nas-iscsi.png

Figure 2. Checking the iSCSI target connection.

Operations

Expanding a PVC

kubectl edit pvc <your pvc name> 

For example: kubectl edit pvc pvc-sample

After a few seconds, the capacity will increase on the NAS. After the pod restarts, the capacity information will be updated.

Cloning a PVC

Create or edit the YAML file Samples/Volumes/pvc-clone.yaml based on your usage requirements.

Example:

apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: pvc-from-clone
spec:
  accessModes:
    - ReadWriteOnce # iSCSI: ReadWriteOnce, Samba: ReadWriteMany
  resources:
    requests:
      storage: 5Gi
  dataSource:
    kind: PersistentVolumeClaim
    name: pvc-sample
  storageClassName: storageclass1

Name the cloned PVC using the name field, configure the storage field, and assign the source PVC in the dataSource field.

Note

The cloned PVC's storage size must be greater than or equal to that of the source PVC.

After configuring the YAML file, run the following command:

kubectl apply -f <your pvc-clone yaml file path> 

For example: kubectl apply -f Samples/Volumes/pvc-clone.yaml

Importing a PVC

iSCSI:
Create or edit the YAML file Samples/Volumes/import/pvc-import.yaml based on your usage requirements.

Important

We recommend importing only LUNs that were originally created by the QNAP CSI driver. A LUN created outside the driver may have a layout that the driver does not recognize, which can lead to unexpected errors after the import.

The LUN's existing filesystem must be one that the QNAP CSI driver supports, and should match the fsType defined in the StorageClass. Importing a LUN with an unsupported filesystem will fail.

Caution

We do not recommend importing a LUN whose iSCSI target also has other LUNs mapped. The driver assumes one LUN per target and cannot reliably identify which device belongs to the imported volume, so the node may attach and format a different LUN on the same target. Enabling multipathd does not prevent this.

Before importing, make sure the LUN is the only LUN mapped to its target.

Example:

kind: PersistentVolumeClaim
apiVersion: v1
metadata:
  name: pvc-import-iscsi
  namespace: default
  annotations:
    trident.qnap.io/importOriginalName: "test"
    trident.qnap.io/importBackendName: "hero"
spec:
  accessModes:
    - ReadWriteOnce
  resources:
    requests:
      storage: 10Gi
  storageClassName: storageclass1

After configuring the YAML file, run the following command:

kubectl apply -f <your pvc-import yaml file path> 

For example: kubectl apply -f Samples/Volumes/import/pvc-import.yaml

Samba: Create or edit the YAML file Samples/Volumes/pvc-import.yaml based on your usage requirements.

Important

We recommend importing only shared folders that were originally created by the QNAP CSI driver. A shared folder created outside the driver may have settings that the driver does not recognize, which can lead to unexpected errors after the import.

kind: PersistentVolumeClaim
apiVersion: v1
metadata:
  name: pvc-import-file
  annotations:
    trident.qnap.io/importOriginalName: "shared-name"
    trident.qnap.io/importBackendName: "qts"
spec:
  accessModes:
    - ReadWriteMany
  resources:
    requests:
      storage: 10Gi # The value entered should correspond to the actual or displayed size.
  storageClassName: storageclass1

Note

Due to filesystem limitations in QTS, the capacity shown in "Storage & Snapshot" may be slightly smaller than the specified size when creating a shared folder. For resources.requests.storage, enter either the specified size or the displayed size. For example: - Specified size: 10GB - Displayed size: 9.34GB. 2025-01-02-120516.png
In QuTS Hero, always use the specified size.

Creating a VolumeSnapshot from a PVC

Create or edit the YAML file Samples/Snapshot/VolumeSnapshot.yaml based on your usage requirements.

Example:

apiVersion: snapshot.storage.k8s.io/v1
kind: VolumeSnapshot
metadata:
  name: pvc-snapshot
spec:
  volumeSnapshotClassName: trident-snapshotclass
  source:
    persistentVolumeClaimName: pvc-sample

After configuring the YAML file, run the following commands one at a time:

kubectl apply -f <VolumeSnapshotClass.yaml> 
kubectl apply -f <VolumeSnapshot.yaml> 

Check the result.

kubectl get volumesnapshot 

Creating a PVC from a Snapshot

Create or edit the YAML file Samples/Volumes/pvc-from-snapshot.yaml based on your usage requirements.

Example:

kind: PersistentVolumeClaim
apiVersion: v1
metadata:
  name: pvc-from-snap
spec:
  accessModes:
    - ReadWriteOnce # iSCSI: ReadWriteOnce, Samba: ReadWriteMany
  resources:
    requests:
      storage: 5Gi
  dataSource:
    name: pvc-snapshot
    kind: VolumeSnapshot
    apiGroup: snapshot.storage.k8s.io
  storageClassName: storageclass1

After configuring the YAML file, run the following command:

kubectl apply -f <pvc-from-snapshot.yaml> 

Reboot

Execute the following commands in order:

kubectl delete tridentorchestrator trident
kubectl apply -f Deploy/Trident/tridentorchestrator.yaml

Uninstallation

  • Uninstalling via Kustomize (normal method)
    Execute the following commands in order:

    kubectl delete deployment trident-operator -n trident 
    
    ./<your tridentctl path> uninstall -n trident 
    
    kubectl delete tridentorchestrator trident 
    
  • Uninstalling via Helm

    helm delete qnap-trident -n trident 
    

Troubleshooting

A pod stays in ContainerCreating with "multipath device not found when it is expected"

The pod event looks like this:

rpc error: code = Internal desc = ... multipath device not found when it is expected

The worker node has the multipath command installed, so the driver requires a multipath device for the volume, but multipathd has not created one.

Check how many interfaces the backend declares in spec.networkInterfaces of its TridentBackendConfig:

  • Zero or one interface. The volume has a single iSCSI path. At its default setting, multipathd never creates a multipath device for a single-path LUN. The tooling is usually present because the distribution installed it, not because it was configured.
    What to do: remove multipath tooling from the worker node, or set find_multipaths no and restart multipathd. See Single-Path iSCSI Setup in Installation.
  • Two or more interfaces. multipathd is not running, or find_multipaths is still at its default setting.
    What to do: set find_multipaths no in /etc/multipath.conf and restart multipathd. See Multipath iSCSI Setup in Installation.

To check the node:

multipath -ll
systemctl status multipathd

A node that prints nothing for multipath -ll but still has the command installed is the first case above.

A pod event says "node does not support multipath; device number should be one, currently N device(s)"

The backend declares more than one network interface, so the volume has several iSCSI paths, but the worker node has no multipath tooling to combine them into one device.

Install and configure multipath tooling on the node as described in Multipath iSCSI Setup in Installation, or reduce the backend to a single network interface.

About

No description, website, or topics provided.

Resources

Stars

72 stars

Watchers

8 watching

Forks

Releases

Packages

Used by

Contributors

Languages