This is the official Container Storage Interface driver for QNAP NAS devices.
Driver Version | Supported Kubernetes Versions | Supported QNAP NAS |
---|---|---|
v1.3.0 | 1.24 to 1.30 | NAS running QTS or QuTS Hero 5.1.0 or later |
Run the following command in both the master and worker nodes.
apt install open-iscsi
Note: Minikube is not supported.
kubectl
is installed and working.
kubectl get pods
kubectl version
kubectl auth can-i '*' '*' --all-namespaces
kubectl run -i --tty ping --image=busybox --restart=Never --rm -- \ping <NAS management IP>
kubectl run -i --tty ping --image=busybox --restart=Never --rm -- \ping 10.64.118.157
git clone https://github.com/qnap-dev/QNAP-CSI-PlugIn.git
cd QNAP-CSI-PlugIn
Run the following commands one at a time 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
Run the following commands one at a time in order.
kubectl apply -k Deploy/crds
kubectl apply -k Deploy/Trident
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
helm install qnap-trident ./Helm/trident -n trident --create-namespace
helm upgrade qnap-trident Helm/trident/ -n trident
Note: You need VolumeSnapshot
to take snapshots.
kubectl apply -k VolumeSnapshot
kubectl get deployment -n trident
trident-controller
and trident-operator
.
kubectl get service -n trident
trident-csi
. Edit the file Samples/backend/backend-sample-qts
or backend-sample-hero.yaml
or create a new one as shown below.
You must configure this file before you create a volume. Each column is required.
apiVersion: v1
kind: Secret
metadata:
name: backend-qts
namespace: trident
type: Opaque
stringData:
username: david
password: abcd1234
storageAddress: 10.20.91.69
---
apiVersion: trident.qnap.io/v1
kind: TridentBackendConfig
metadata:
name: backend-qts
namespace: trident
spec:
version: 1
storageDriverName: qnap-iscsi
backendName: qts
networkInterfaces: ["K8s-ISCSI"] #optional
credentials:
name: backend-qts
debugTraceFlags:
method: true
storage:
- serviceLevel: Any
labels:
performance: any
- serviceLevel: SSD-Cache
labels:
performance: premium
features:
tiering: Enable
ssdCache: "true"
- serviceLevel: Tiering
labels:
performance: standard
features:
tiering: Enable
- serviceLevel: Non-Tiering
labels:
performance: basic
features:
tiering: Disable
- serviceLevel: RAID0
labels:
performance: raid0
features:
raidLevel: "0"
- serviceLevel: RAID1
labels:
performance: raid1
features:
raidLevel: "1"
- serviceLevel: RAID5
labels:
performance: raid5
features:
raidLevel: "5"
Add a backend to your orchestrator.
Edit the file Samples/backend/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,
"storageDriverName": "qnap-iscsi",
"backendName": "qts-david",
"storageAddress": "10.20.91.69",
"username": "david",
"password": "abcd1234",
"networkInterfaces": ["K8s-ISCSI"],
"debugTraceFlags": {"method":true},
"storage": [
{
"labels": {"storage": "qts-david"},
"serviceLevel": "Any"
},
{
"labels": {"performance": "premium"},
"features":{
"tiering": "Enable",
"ssdCache": "true"
},
"serviceLevel": "SSD-Cache"
},
{
"labels": {"performance": "standard"},
"features":{
"tiering": "Enable"
},
"serviceLevel": "Tiering"
},
{
"labels": {"performance": "basic"},
"features":{
"tiering": "Disable"
},
"serviceLevel": "Non-Tiering"
}
]
}
Edit the file Samples/StorageClass/sc.yaml
or create a new one as shown below.
apiVersion: storage.k8s.io/v1
kind: StorageClass
metadata:
name: premium
provisioner: csi.trident.qnap.io
parameters:
selector: "performance=premium"
allowVolumeExpansion: true
---
apiVersion: storage.k8s.io/v1
kind: StorageClass
metadata:
name: standard
provisioner: csi.trident.qnap.io
parameters:
selector: "performance=standard"
allowVolumeExpansion: true
---
apiVersion: storage.k8s.io/v1
kind: StorageClass
metadata:
name: basic
provisioner: csi.trident.qnap.io
parameters:
selector: "performance=basic"
allowVolumeExpansion: true
---
apiVersion: storage.k8s.io/v1
kind: StorageClass
metadata:
name: any
provisioner: csi.trident.qnap.io
parameters:
selector: "performance=any"
allowVolumeExpansion: true
Edit the file Samples/Volumes/pvc-any.yaml
or create a new one as shown below.
kind: PersistentVolumeClaim
apiVersion: v1
metadata:
name: pvc-any-1
annotations:
# thin allocate & threshold is customized
trident.qnap.io/threshold: "90"
trident.qnap.io/ThinAllocate: "true"
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 10Gi
storageClassName: any
kubectl apply -f <backend yaml file path>
kubectl get tridentbackendconfigs.trident.qnap.io -n trident
tridentctl
.
chmod u+x tridentctl
./bin/tridentctl create backend -f <backend.json> -n trident
./bin/tridentctl create backend -f Samples/backend/backend-sample.json -n trident
kubectl get pods -n trident
kubectl apply -f <StorageClass.yaml>
kubectl apply -f Samples/StorageClass/sc.yaml
kubectl apply -f <pvc.yaml>
kubectl apply -f Samples/Volumes/pvc-any.yaml
kubectl edit pvc <pvc name>
kubectl edit pvc pvc-any
kubectl apply -f <pvc-clone.yaml>
kubectl apply -f <pvc-import.yaml>
kubectl apply -f <vol-snapshot.yaml>
kubectl apply -f <pod yaml file>
kubectl apply -f Samples/pod.yaml
kubectl get pods
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.
kubectl apply -f <VolumeSnapshotClass.yaml>
kubectl apply -f <VolumeSnapshot.yaml>
kubectl get volumesnapshot
kubectl apply -f <pvc-from-snapshot.yaml>
kubectl apply -f <pod2.yaml>
Run the following commands one at a time in order.
kubectl delete deployment trident-operator -n trident
./bin/tridentctl uninstall -n trident
kubectl delete tridentorchestrator trident
helm delete qnap-trident -n trident
kubectl delete tridentorchestrator trident
kubectl apply -f Deploy/Trident/tridentorchestrator.yaml