kubernetes-csi/csi-driver-nfs

Remount when connection lost

barthofu opened this issue · 6 comments

Is your feature request related to a problem?/Why is this needed

Hello, i don't really know if it's an intended or normal behavior but each time i'm losing my NFS connection and then get it back up, it won't remount the disks in my pods.

I'm then in the obligation of restarting the pods...

Would it be possible to automate the NFS remount into the pod?

@barthofu have you tried -o hard mount option?

there is an NFS mount option that you can use to remount the NFS share when the server is unavailable and then recovers. The option is called hard and it makes the NFS client keep retrying the NFS server indefinitely until it becomes available again.

Here's an example command to mount an NFS share with the hard option:

mount -t nfs -o hard <nfs-server>:<nfs-share> <mount-point>

I think unless you specify soft, hard is on by default.

Edit: In a much older issue from the kubernetes repo (which I assume is a different implementantion from the csi-driver one), someone mentioned they fixed their problem by using a different NFS server image: kubernetes/kubernetes#75918 (comment)