nfs-subdir-external-provisioner: Azure NFS does not allow mounting subdir - NSEP fails when storage-path is not "./"

Hello,

Azure NFS does not allow mounting subdir

When storage-path is not “./”, NSEP appends the path to the mount string causing it to fail

MountVolume.SetUp failed for volume "pvc-XXXXXX" : mount failed: exit status 32 

Mounting command: systemd-run Mounting arguments: 

--description=Kubernetes transient mount for /var/lib/kubelet/pods/YYYY/volumes/kubernetes.io~nfs/pvc-XXXXX --scope 
-- mount -t nfs -o noac,nolock,proto=tcp,relatime,sec=sys,vers=3 STORAGE.blob.core.windows.net:/STORAGE/CONTAINER/nfs-client-test-1-test-claim-pvc-XXXXX /var/lib/kubelet/pods/YYYYY/volumes/kubernetes.io~nfs/pvc-XXXXX

Output: Running scope as unit: run-ZZZZZZZZZ.scope

mount.nfs: mounting STORAGE.blob.core.windows.net:/STORAGE/CONTAINER/nfs-client-test-1-test-claim-pvc-XXXX failed, reason given by server: No such file or directory

If I mount STORAGE.blob.core.windows.net:/STORAGE/CONTAINER/ it works perfectly

If I mount STORAGE.blob.core.windows.net:/STORAGE/CONTAINER/FOLDER it obviously fails (due to azure’s fault)

If I override the path (using pathPattern) and set it to ./ it tries and succeeds to mount the root NFS share.

Is there a way to decouple the path from the NFS mount path?

Thanks!

Deploy

helm repo add nfs-subdir-external-provisioner https://kubernetes-sigs.github.io/nfs-subdir-external-provisioner/
helm repo update

helm install nfs-subdir-external-provisioner-3 nfs-subdir-external-provisioner/nfs-subdir-external-provisioner \
  --namespace nfs-subdir-external-provisioner-3 \
  --create-namespace \
  --set replicaCount=1 \
  --set storageClass.name=nfs-client3 \
  --set storageClass.reclaimPolicy=Retain \
  --set storageClass.accessModes=ReadWriteMany \
  --set nfs.server=STORAGE.blob.core.windows.net \
  --set nfs.path=/STORAGE/CONTAINER \
  --set 'nfs.mountOptions={relatime,nolock,noac,sec=sys,vers=3,proto=tcp}' \
  --set nfs.volumeName=nfs

PVC

kind: PersistentVolumeClaim
apiVersion: v1
metadata:
  name: test-claim
#  annotations:
#    nfs.io/storage-path: "./" # not required, depending on whether this annotation was shown in the storage class description

spec:
  storageClassName: nfs-client3
  accessModes:
    - ReadWriteMany
  resources:
    requests:
      storage: 1Mi

Pod

apiVersion: v1
kind: ReplicationController

metadata:
  name: nfs-busybox
  #namespace: nfs-test

spec:
  replicas: 1

  selector:
    name: nfs-busybox

  template:
    metadata:
      labels:
        name: nfs-busybox

    spec:
      containers:
      - image: busybox
        command:
          - sh
          - -c
          - 'while true; do date > /data/index.html; hostname >> /data/index.html; sleep $(($RANDOM % 5 + 5)); done'
        imagePullPolicy: IfNotPresent
        name: busybox
        volumeMounts:
          # name must match the volume name below
          - name: nfs
            mountPath: /data
          #- name: nfs-3-1-busybox
          #  mountPath: /data

      volumes:
      - name: nfs
        persistentVolumeClaim:
          claimName: test-claim

Temporary solution

        volumeMounts:
          - name: nfs
            mountPath: /data
            subPath: "nfs-busybox"

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Comments: 15 (1 by maintainers)

Most upvoted comments

hello,did you solve your problem. I have the same problem