Accessmode in PVC and pod

3/20/2019

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.

-- ambikanair
kubernetes
kubernetes-pvc
persistent-volumes

1 Answer

4/17/2019

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.

-- PjoterS
Source: StackOverflow