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.