Docker-Swarm & NFS4-Volume gives [Errno 9] Bad file descriptor

I also stumbled upon this issue and was able to get my test environment working using NFSv3 with the parameter local_lock=all.

Here is an example of a working persistent volume for Kubernetes:

apiVersion: v1
kind: PersistentVolume
metadata:
  name: checkmk-data-0
  namespace: checkmk
spec:
  capacity:
    storage: 16Gi
  volumeMode: Filesystem
  accessModes:
    - ReadWriteOnce
  persistentVolumeReclaimPolicy: Retain
  storageClassName: fast
  mountOptions:
    - hard
    - vers=3
    - nfsvers=3
    - local_lock=all
  nfs:
    path: /exporteddirectory/checkmk
    server: testfile.example.com

Although it is working, using NFSv3 doesn’t feel right nowadays.
So I would really appreaciate a solution with NFSv4.