For PersistentVolumeBlock, the value of volumeDevices.devicePath in Pod yaml can be “/dev/volume1”. But if I change to “/mnt/volume1”, it will get permission error as below when I execute blockdev command in the Pod.
/ # blockdev --getss /mnt/volume1
blockdev: can’t open ‘/mnt/volume1’: Permission denied
For e2e test in multhvolume.go, it always pass “/mnt/volume1” path in storageutils.GetSectorSize().
Is it correct ? should we change it to “/dev/volume1” for PersistentVolumeBlock.
Cluster information:
Kubernetes version: 1.26
Cloud being used: (put bare-metal if not on a public cloud)
Installation method:
Host OS: Ubuntu 22.04.1 LTS
CNI and version: Weave
CRI and version: crio version 1.23.4
I try it on csi-driver-host-path CSI driver, it still not support volumeDevices.devicePath in Pod yaml is “/mnt/volume1”.
The below is my yaml content of test file,
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: csi-pvc-block
spec:
volumeMode: Block
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 5Gi
storageClassName: csi-storage
kind: Pod
apiVersion: v1
metadata:
name: test-pod-block
spec:
containers:
- image: busybox
command: [“/bin/sh”, “-c”]
args: [ “tail -f /dev/null” ]
name: test-container
securityContext:
privileged: true
capabilities:
add: [“SYS_ADMIN”]
volumeDevices:
- name: vol
devicePath: /mnt/volume1
volumes:
- name: vol
persistentVolumeClaim:
claimName: csi-pvc-block
The conclusion is it seems the value of volumeDevices.devicePath in Pod yaml should be /dev/volume1.