Questions about PersistentVolume PersistentVolumeClaim and NFS storageclass

Hi all,
I have a K8S cluster on premise init by kubeadm.
I have Synology NAS as NFS server 192.168.7.107 , shared folder path /k8s-nfs-sgnnas02 is grant RW permission to all K8S cluster nodes .
I have deployed nfs-subdir-external-provisioner/nfs-subdir-external-provisioner successfully, Everything works fine.
I have a manifest like this

apiVersion: v1
kind: PersistentVolume
metadata:
  name: bacula-fd-pv
spec:
  capacity:
    storage: 200Gi
  volumeMode: Filesystem
  accessModes:
    - ReadOnlyMany
  persistentVolumeReclaimPolicy: Retain
  storageClassName: nfs-sgnnas02
  claimRef:
    name: bacula-fd-pvc
    namespace: backup
  mountOptions:
    - hard
    - nfsvers=3
  nfs:
    path: /k8s-nfs-sgnnas02
    server: 192.168.7.107
    readOnly: true
---
kind: PersistentVolumeClaim
apiVersion: v1
metadata:
  name: bacula-fd-pvc
  namespace: backup
spec:
  storageClassName: nfs-sgnnas02
  volumeName: bacula-fd-pv
  accessModes:
    - ReadOnlyMany
  resources:
    requests:
      storage: 200Gi
---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: k8s-bacula-fd
  namespace: backup
  labels:
    app: bacula-fd
spec:
  selector:
    matchLabels:
      app: bacula-fd
  replicas: 1
  template:
    metadata:
      labels:
        app: bacula-fd
    spec:
      containers:
      - image: marfeel/bacula-fd:5.0
        name: k8s-bacula-fd
        volumeMounts:
        - name: k8s-nfs-sgnnas02
          mountPath: /backup/k8s-nfs-sgnnas02
      volumes:
      - name: k8s-nfs-sgnnas02
        persistentVolumeClaim:
            claimName: bacula-fd-pvc

I attempt to deploy a bacula client , mount 192.168.7.107:/k8s-nfs-sgnnas02 to /backup/k8s-nfs-sgnnas02 as READONLY
But when I exec onto bacula-fd pod I can create new file in /backup/k8s-nfs-sgnnas02 ?
So “accessModes ReadOnlyMany” and “readOnly: true” above seem not work ?
The “storage: 200Gi” seems not work too since when I exec into bacula-fd pod and run this command

root@k8s-bacula-fd-85db89d87b-mkdbl:/# df -h
Filesystem                         Size  Used Avail Use% Mounted on
overlay                             38G   13G   24G  36% /
tmpfs                               64M     0   64M   0% /dev
192.168.7.107:/k8s-nfs-sgnnas02     15T  3.5T   12T  24% /backup/k8s-nfs-sgnnas02
/dev/mapper/ubuntu--vg-ubuntu--lv   38G   13G   24G  36% /etc/hosts
shm                                 64M     0   64M   0% /dev/shm
tmpfs                              7.7G   12K  7.7G   1% /run/secrets/kubernetes.io/serviceaccount
tmpfs                              3.9G     0  3.9G   0% /proc/acpi
tmpfs                              3.9G     0  3.9G   0% /proc/scsi
tmpfs                              3.9G     0  3.9G   0% /sys/firmware

The size of /backup/k8s-nfs-sgnnas02 is not 200G , instead , it is equal the size of NFS shared folder.
Please give me some advice, thank you very much.

Hello, I met the same problem, have you solved it yet?

Hi @usrchen
what is you problem ?
If your problem is the size of mount point display incorrectly , that is how it works, I cannot do anything with it.
If your problem is accessModes: ReadOnlyMany doesn’t work, that is because it is not the way to do it. To prevent pod from writing data to mount point you have to use readOnly: true at volumeMounts:
This is example:

apiVersion: apps/v1
kind: Deployment
metadata:
  name: k8s-bacula-fd
  namespace: backup
  labels:
    app: bacula-fd
spec:
  selector:
    matchLabels:
      app: bacula-fd
  replicas: 1
  template:
    metadata:
      labels:
        app: bacula-fd
    spec:
      containers:
      - image: marfeel/bacula-fd:5.0
        name: k8s-bacula-fd
        volumeMounts:
        - name: k8s-nfs-idcnas002
          mountPath: /backup/k8s-nfs-idcnas002
          readOnly: true
        - name: bacula-fd-conf
          mountPath: /opt/bacula/etc/bacula-fd.conf
          subPath: bacula-fd.conf
          readOnly: true
      volumes:
      - name: k8s-nfs-idcnas002
        persistentVolumeClaim:
            claimName: bacula-fd-idcnas002-pvc
      - name: bacula-fd-conf
        configMap:
          name: bacula-fd-conf