kubernetespersistent-volumeskubernetes-pvc

Accessmode in PVC and pod


I have a pvc with accessmode ReadOnlyMany. I created a pod which uses the above pvc and found that I can write to the mounted path. Is this expected behaviour or something to do with the volume plugin that I am using.


Solution

  • Without more information is hard to say what it is.

    The most common mistakes are:

    1) Like @vaqars mentioned in comment it could be lack of readOnly:true element in pod/deployment manifest.

    volumes:
    - name: <volumeName>
      persistentVolumeClaim:
        claimName: <claimName>
        readOnly: true
    

    2) Your PersistentVolume and PersistentVolumeClaim does not have accessMode: ReadOnlyMany.

    3) Your Volume Plugin might not support ReadOnlyMany. Please check here if your Volume Plugin supports this access mode.