Kubernetes - when specified in pvc "volumeMode: Block" NodePublishVolume is not called

1/12/2020

I am working on CSI driver and need to support block volume (in addition to filesystem we already have)

When specifying volumeMode: Block NodeStageVolume and NodePublishVolume are not called.

When removing volumeMode: Block and in POD change volumeDevices entry to volumeMounts it works fine

PV descriptiopn shown VolumeMode: Block Added featuregates BlockVolume=true,CSIBlockVolume=true in kube-apiserver.yaml

We are using k8s 1.14

Any idea what can be the reason or any suggestion how to investigate (e.g. which logs to see except node an controller)?

thank you

kind: PersistentVolumeClaim
apiVersion: v1
metadata:
  name: pvcraw67b
spec:
  volumeMode: Block
  storageClassName: sc67b
  accessModes:
    - ReadWriteOnce
  resources:
    requests:
      storage: 1Gi
kind: Pod
apiVersion: v1
metadata:
  name: podraw67b
spec:
    containers:
       - name: fc-container
         image: fedora:26
         command: ["/bin/sh", "-c"]
         args: [ "tail -f /dev/null" ]      
         volumeDevices:
              - devicePath: /dev/block
                name: pvcrawvol67b
    volumes:
      - name: pvcrawvol67b
        persistentVolumeClaim:
            claimName: pvcraw67b
-- Igor Gonopolskiy
kubernetes
storage

1 Answer

1/14/2020

On prem.

kubelet logs has reoccurring error:speifying that the feature is not enabled reconciler.go:248] operationExecutor.MountVolume failed (controllerAttachDetachEnabled true) for volume … (UniqueName: …) pod “…” (UID: “…”) : MapVolume.NewBlockVolumeMapper initialization failed for volume “…” (UniqueName: “…”) pod “…” (UID: “…”) : CSIBlockVolume feature not enabled

-- Igor Gonopolskiy
Source: StackOverflow