alibaba / open-local

cloud-native local storage management system for stateful workload, low-latency with simplicity
Apache License 2.0
463 stars 81 forks source link

device pv faile to mount as fs #164

Closed liyimeng closed 2 years ago

liyimeng commented 2 years ago

Ⅰ. Issue Description

Try to use device volumeType and mount as fs. PV seem fail to mount

Ⅱ. Describe what happened

Apply a yaml file like this:

apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: dev-fs-pvc
spec:
  volumeMode: Filesystem
  accessModes:
  - ReadWriteOnce
  resources:
    requests:
      storage: 5Gi
  storageClassName: open-local-device-hdd
---
apiVersion: v1
kind: Pod
metadata:
  name: "open-local-test-dev-fs"
spec:
  containers:
  - name: dev-fs
    image: busybox
    volumeMounts:
    - mountPath: "/data"
      name: data
    command:
    - stat 
    - /data
  volumes:
   - name: data
     persistentVolumeClaim:
       claimName: dev-fs-pvc
  restartPolicy: Never
Events:
  Type     Reason            Age                From               Message
  ----     ------            ----               ----               -------
  Warning  FailedScheduling  38s                default-scheduler  running PreBind plugin "VolumeBinding": binding volumes: provisioning failed for PVC "dev-fs-pvc"
  Warning  FailedScheduling  35s                default-scheduler  running PreBind plugin "VolumeBinding": binding volumes: provisioning failed for PVC "dev-fs-pvc"
  Normal   Scheduled         31s                default-scheduler  Successfully assigned open-local/open-local-test-dev-fs to node2
  Warning  FailedMount       13s (x6 over 29s)  kubelet            MountVolume.SetUp failed for volume "local-7859a7ae-c56c-48eb-8c36-dd898f1ab22f" : rpc error: code = Internal desc = NodePublishVolume(FileSystem): mount device volume local-7859a7ae-c56c-48eb-8c36-dd898f1ab22f with path /var/lib/kubelet/pods/249942c1-26ee-41e4-8a05-1e67ee9deaab/volumes/kubernetes.io~csi/local-7859a7ae-c56c-48eb-8c36-dd898f1ab22f/mount with error: rpc error: code = Internal desc = mount failed: exit status 32
Mounting command: mount
Mounting arguments: -t ext4 -o rw,defaults /dev/vdd /var/lib/kubelet/pods/249942c1-26ee-41e4-8a05-1e67ee9deaab/volumes/kubernetes.io~csi/local-7859a7ae-c56c-48eb-8c36-dd898f1ab22f/mount
Output: mount: wrong fs type, bad option, bad superblock on /dev/vdd,
       missing codepage or helper program, or other error

       In some cases useful info is found in syslog - try
       dmesg | tail or so.

Ⅲ. Describe what you expected to happen

pv should be mounted, pod should run

Ⅳ. How to reproduce it (as minimally and precisely as possible)

  1. Apply yaml as above
  2. Pod stuck in creating state
  3. kubectl describe the targeting pod and see the error msg

Ⅴ. Anything else we need to know?

Ⅵ. Environment:

TheBeatles1994 commented 2 years ago

Because your device has file system, try to use command wipefs to remove fs on device.

liyimeng commented 2 years ago

hmm, make sense. but what if a pv is removed? will file system on the device get wiped off, make it available for use again?

TheBeatles1994 commented 2 years ago

https://github.com/alibaba/open-local/blob/179b12cd9e51a44ed2c7fcfd411109255c7d914a/pkg/csi/controllerserver.go#L591

The device will be wiped if PV is deleted.

liyimeng commented 2 years ago

Thanks a lot! @TheBeatles1994