I've recently started using NFS volumes for my clusters on-prem. This is the simplest and best solution for me, however it seems pretty limited in regards to the actual mounts options.
Is there anyway to set mount options on the node/cluster in the volume.yml files?
I have application that requires a specific version and also these mount options for performance.
apiVersion: v1
kind: PersistentVolume
metadata:
name: nfs
spec:
capacity:
storage: 1Mi
accessModes:
- ReadWriteMany
nfs:
# FIXME: use the right IP
server: 10.244.1.4
path: "/"
Is there anyway to add mount flags here?
If someone is looking for answers in 2021, here is what is working for me.
mountOptions:
- hard
- timeo=600
- retrans=3
- proto=tcp
- nfsvers=4.2
- port=2050
- rsize=4096
- wsize=4096
- noacl
- nocto
- noatime
- nodiratime
It is possible and it's been GA in Kubernetes since 1.8.
apiVersion: v1
kind: PersistentVolume
metadata:
name: pv0003
spec:
capacity:
storage: 5Gi
volumeMode: Filesystem
accessModes:
- ReadWriteOnce
persistentVolumeReclaimPolicy: Recycle
storageClassName: slow
mountOptions:
- hard
- nfsvers=4.1
nfs:
path: /tmp
server: 172.17.0.2
https://kubernetes.io/docs/concepts/storage/persistent-volumes/#mount-options
https://github.com/kubernetes/enhancements/issues/168#issuecomment-317748159
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With