This is the official Container Storage Interface driver for QNAP NAS devices.
Driver Version | Supported Kubernetes Versions | Supported QNAP NAS |
---|---|---|
v1.0.0-beta | 1.14 to 1.23 | NAS running QTS 5.0.0 or later |
- 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
- Add StorageClasses
- Add, resize, clone, and import Persistent Volume Claims (PVCs)
- Take snapshots
Run the following command in both the master and worker nodes.
apt install open-iscsi
Note: Minikube is not supported.
- Make sure
kubectl
is installed and working.- Run the following commands one at a time.
kubectl get pods
kubectl version
- Verify that you are logged in as a Kubernetes cluster administrator.
kubectl auth can-i '*' '*' --all-namespaces
- The result should be "yes".
- Verify that you can launch a pod that uses an image from Docker Hub and can reach your storage system over the pod network.
kubectl run -i --ttyping --image=busybox --restart=Never --rm --\ping <NAS management IP>
- For example:
kubectl run -i --tty ping --image=busybox --restart=Never --rm -- \ping 10.64.118.157
- Verify that your NAS has created a storage pool and iSCSI service is enabled.
- To check storage pools on your NAS, open Storage & Snapshots and go to Storage > Storage/Snapshots.
- To check iSCSI service on your NAS, open iSCSI & Fibre Channel and verify that the toggle button is on.
- Clone the git repository.
git clone https://github.com/qnap-dev/QNAP-CSI-PlugIn.git
- Enter the directory.
cd QNAP-CSI-PlugIn
- Select one of the following installation methods.
Run the following commands one at a time in order.
kubectl apply -f Deploy/Trident/namespace.yaml
kubectl apply -f Deploy/Trident/crds/trident_CRD.yaml
kubectl apply -f Deploy/Trident/bundle.yaml
kubectl apply -f Deploy/Trident/tridentorchestrator.yaml
Run the following commands one at a time in order.
kubectl apply -k Deploy/crds
kubectl apply -k Deploy/Trident
- Install Helm (for Ubuntu).
- Run the following commands one at a time in order.
curl https://baltocdn.com/helm/signing.asc | sudo apt-key add -
sudo apt-get install apt-transport-https --yes
echo "deb https://baltocdn.com/helm/stable/debian/ all main" | sudo tee /etc/apt/sources.list.d/helm-stable-debian.list
sudo apt-get update
sudo apt-get install helm
- Install the CSI plugin.
helm install qnap-trident ./qnap-trident -n trident --create-namespace
Note: You need VolumeSnapshot
to take snapshots.
kubectl apply -k VolumeSnapshot
kubectl get deployment -n trident
- The result should include
trident-csi
andtrident-operator
.
Add a backend to your orchestrator.
Edit the file Samples/backend-qts1.json
or create a new one as shown below.
You must configure this file before you create a volume. Each column is required.
{
"version": 1,
"operatorVersion": "v1.0.0-beta",
"storageVersion": "v1.0.0-beta",
"storageDriverName": "qnap-iscsi",
"backendName": "QTS1",
"storageAddress": "<QTS IP Address>",
"username": "<QTS Username>",
"password": "<QTS Password>",
"debugTraceFlags": {"api":false, "method":true},
"storage": [
{
"labels": {"performance": "premium"},
"features":{
"tiering": "Enable",
"tierType": "SSD",
"ssdCache": "true"
},
"serviceLevel": "premium"
},
{
"labels": {"performance": "standard"},
"features":{
"tiering": "Enable",
"tierType": "SSD"
},
"serviceLevel": "standard"
},
{
"labels": {"performance": "basic"},
"features":{
"tiering": "Disable",
"tierType": "SATA"
},
"serviceLevel": "basic"
}
]
}
Edit the file Samples/storage-class-qnap-qos.yaml
or create a new one as shown below.
apiVersion: storage.k8s.io/v1
kind: StorageClass
metadata:
name: premium
provisioner: csi.trident.qnap.io #k8s CSI provisioner
parameters:
selector: "performance=premium"
allowVolumeExpansion: true
Edit the file Samples/pvc-basic.yaml
or create a new one as shown below.
kind: PersistentVolumeClaim
apiVersion: v1
metadata:
name: pvc-basic
annotations:
trident.qnap.io/ThinAllocate: "false"
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 5Gi
storageClassName: basic
- Make sure you have a corresponding pool.
- Ensure you have the permission to execute
tridentctl
.
chmod u+x tridentctl
- Add a backend based on the JSON file you configured earlier.
./tridentctl create backend -f <backend.json> -n trident
- For example:
./tridentctl create backend -f Samples/backend-qts1.json -n trident
- This should take around 30 seconds or less.
- 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.
- Check the result.
- Run the following commands one at a time.
kubectl get pods -n trident
kubectl get qpools -n trident
- Apply the StorageClass YAML file you configured earlier.
kubectl apply -f <StorageClass.yaml>
- For example:
kubectl apply -f Samples/storage-class-qnap-qos.yaml
- Check the result.
kubectl get sc -n trident
- Add a PVC.
kubectl apply -f <pvc.yaml>
- For example:
kubectl apply -f Samples/pvc-basic.yaml
- This example creates a thick LUN. If you want to create a thin LUN, refer to the
Samples/pvc-standard.yaml
file.
- Check that the PVC is on the PVC list and its status is "Bound".
kubectl get pvc
- Check that the NAS has created the LUN.
kubectl get qnapvolume -n trident
- Resize a PVC.
kubectl edit pvc <pvc name>
- For example:
kubectl edit pvc pvc-basic
- After a few seconds, the capacity will increase on the NAS.
- Check the result.
kubectl get pvc
- After the pod restarts, information on the capacity will be updated.
- Clone a PVC.
kubectl apply -f <pvc-clone.yaml>
- Check the result.
kubectl get pvc
- Import a PVC.
./tridentctl import volume <Backend Name> <LUN Name> -f <pvc-import.yaml> -n trident
- Check the result.
kubectl get pvc -n trident (or -A)
kubectl apply -f <vol-snapshot.yaml>
Note: Once a PVC is successfully created, the corresponding qnapvolume
will also be created, which has detailed information on the volume. An admin can check whether the volume has been created via the Kubernetes user interface.
- Deploy a pod.
kubectl apply -f <pod yaml file>
- For example:
kubectl apply -f Samples/pod.yaml
- Check the result.
kubectl get pods
- Check the connection has been mapped on the NAS by opening iSCSI & Fibre Channel.
- Use the logs to check whether the pod is running normally.
You can now mount a PVC to the pod.
Note: After deploying the pod, the only thing you can do with the pod is print out its timestamp.
- Create a VolumeSnapshot from a PVC.
- Run the following commands one at a time.
kubectl apply -f <VolumeSnapshotClass.yaml>
kubectl apply -f <VolumeSnapshot.yaml>
- Check the result.
- Run the following commands one at a time.
kubectl get volumesnapshot
kubectl get qsnapshot -n trident
Note:
Once volumesnapshot
is created successfully, the corresponding qsnapshot
will also be created, which records the snapshot information in the storage. An admin can check whether the snapshot has been created via the Kubernetes user interface.
- Create a PVC from a snapshot.
- Run the following commands one at a time.
kubectl apply -f <pvc-from-snapshot.yaml>
kubectl apply -f <pod2.yaml>
- Verify the PVC has been successfully created from the snapshot.
- Create a new pod and mount the snapshot-pvc in the pod.
- Access the pod and check if the PVC contains the directory you created before.
Run the following commands one at a time in order.
kubectl delete deployment trident-operator -n trident
./tridentctl uninstall -n trident
kubectl delete tridentorchestrator trident
helm delete qnap-trident -n trident