SynologyOpenSource / synology-csi

Apache License 2.0
499 stars 107 forks source link

Use static provisioning to bind an already created LUN. #88

Closed win5923 closed 1 month ago

win5923 commented 1 month ago

Since I've already created a LUN on the NAS, I would like to ask if there is a method like built-in Kubernetes static provisioning to bind to an already existing LUN, as follows:

apiVersion: v1
kind: Pod
metadata:
  name: iscsipd
spec:
  containers:
  - name: iscsipd-rw
    image: kubernetes/pause
    volumeMounts:
    - mountPath: "/mnt/iscsipd"
      name: iscsipd-rw
  volumes:
  - name: iscsipd-rw
    iscsi:
      targetPortal: 10.0.2.15:3260
      portals: ['10.0.2.16:3260', '10.0.2.17:3260']
      iqn: iqn.2001-04.com.example:storage.kube.sys1.xyz
      lun: 0
      fsType: ext4
      readOnly: true

The method might involve adding iqn and lun fields to the volumeAttributes.

apiVersion: v1
kind: PersistentVolume
metadata:
  name: synology-lun
spec:
  capacity:
    storage: 1Gi
  csi:
    driver: csi.san.synology.com
    volumeHandle: test 
    fsType: btrfs
    volumeAttributes:
      dsm: xxx
      formatOptions: '--nodiscard'
      protocol: iscsi
      iqn: "xxxxxxx"
      lun: "0"
  accessModes:
    - ReadWriteOnce
  persistentVolumeReclaimPolicy: Retain
  storageClassName: synology-iscsi-storage
  volumeMode: Filesystem

I tried the above YAML approach, but encountered the error: NotFound desc = volume[test ] is not found. How does volumeHandle correspond to the LUN on the NAS?

win5923 commented 1 month ago

I've found that my issue is similar to #14, so I'm closing this one.