kubernetes-csi / csi-driver-iscsi

Apache License 2.0
101 stars 63 forks source link

Raw Block Volume support #302

Open Bytamine opened 3 weeks ago

Bytamine commented 3 weeks ago

Hello, I'm trying to understand if it's possible to mount ISCSI volume in raw block mode as specified here: https://kubernetes.io/docs/concepts/storage/persistent-volumes/#raw-block-volume-support There is no example on how to do it, so it is possible that I missed something.

Here is my full yaml configuration:

apiVersion: v1
kind: PersistentVolume
metadata:
  name: iscsi-pv-vm-block-storage
spec:
  storageClassName: iscsi
  accessModes:
    - ReadWriteOnce
  volumeMode: Block
  capacity:
    storage: 100Gi
  csi:
    driver: iscsi.csi.k8s.io
    volumeHandle: iscsi-data-id
    volumeAttributes:
      targetPortal: "192.0.4.10:3260"
      portals: "[]"
      iqn: "iqn.2001-05.com.equallogic:0-6694d6-047520d8d-e90bc5aeb1267069-iscsi11-emanthos"
      lun: "0"
      iscsiInterface: "default"
      discoveryCHAPAuth: "true"
      sessionCHAPAuth: "false"
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: iscsi-pvc-vm-block-storage
spec:
  accessModes:
    - ReadWriteOnce
  volumeMode: Block
  resources:
    requests:
      storage: 100Gi
  storageClassName: iscsi
  volumeName: iscsi-pv-vm-block-storage
---
apiVersion: v1
kind: Pod
metadata:
  labels:
    run: nginx-block
  name: nginx-block
spec:
  containers:
  - image: nginx
    name: nginx
    volumeDevices:
    - name: block-disk
      devicePath: /dev/xvda
  volumes:
  - name: block-disk
    persistentVolumeClaim:
      claimName: iscsi-pvc-vm-block-storage

and here is what I see in pod describe:

Mounting command: mount
Mounting arguments:  -o bind /var/lib/kubelet/plugins/kubernetes.io/csi/volumeDevices/publish/iscsi-pv-vm-block-storage/8f1f0c45-8be8-48be-af7e-d56221efd3cf /var/lib/kubelet/plugins/kubernetes.io/csi/volumeDevices/iscsi-pv-vm-block-storage/dev/8f1f0c45-8be8-48be-af7e-d56221efd3cf
Output: mount: /var/lib/kubelet/plugins/kubernetes.io/csi/volumeDevices/iscsi-pv-vm-block-storage/dev/8f1f0c45-8be8-48be-af7e-d56221efd3cf: mount point is not a directory