#subPath of externally managed PVC won't work

1 messages · Page 1 of 1 (latest)

jagged shore
#

Hi, We are running 23.10 and have created a PVC pointing to a Netapp share that we manage externally, so just as a regular NFS. When I try to mount this share making use of subPath, it throws an error:

 Error: failed to prepare subPath for volumeMount "pv-nfs" of container "lift-nginx"
        volumeMounts:
        - mountPath: /mnt/ARCHIVING
          name: pv-nfs
          subPath: ARCHIVING
frank nova
#

Does the path already exist on the NFS share? (I'm assuming no, but I don't like assuming)

jagged shore
#

sorry, I was on vacation

#

the path is existing , we even give 777 to the path to avoid permission issues

raven plume
#
jagged shore
#

this is the content of the volume:

drwxr-sr-x. 10 25785 1722 8192 Sep 18 09:17 CRIMS
drwxr-sr-x.  3 25785 1722 4096 Sep 19 15:00 common
drwxr-sr-x.  3 25785 1722 4096 Sep 21 09:55 tmp
drwxr-sr-x.  3 25785 1722 4096 Oct  6 12:24 CD037149
drwxrwsrwx.  6 25785 1722 4096 Nov 27 10:30 ARCHIVING

so if I now try to do:

        volumeMounts:
        - mountPath: /mnt
          name: pv-nfs-crims-gr
          subPath: ARCHIVING

it will fail....but if I remove the subPath, then it will work

frank nova
jagged shore
#

still the same error:
Error: failed to prepare subPath for volumeMount "pv-nfs-crims-gr" of container "lift-nginx"

frank nova
frank nova
#

I tested this in our lab and the subPath works with Trident.

        - mountPath: "/data/ARCHIVING"
          name: task-pv-storage
          subPath: ARCHIVING```
I created the directory before creating the pod. 
```[root@rhel2 mount]# ls -la
total 8
drwxrwxrwx 3 nobody nobody 4096 Jan 15 14:22 .
drwxr-x--- 3 root   root     38 Jan 15 14:24 ..
drwxr-xr-x 2 nobody nobody 4096 Jan 15 14:28 ARCHIVING```
Then created the pod and checked that the subPath was mounted inside as it ought to be.  It worked correctly.
jagged shore
#

sorry, I have just found this is not a trident volume but just a regular Netapp NFS volume, so it might have different settings

#

what do you mean by the kubelet will be squashed ?

frank nova
#

The error seems to be based in the Kubernetes layer more than the NFS/Trident layer. I'm not sure exactly what the writer of the phrase meant, but I just realized that I had root squash enabled on my export policy and it didn't affect my use of the subPath, so I'd ignore that one. Sorry for the confusion there. At this point I'd say to googl the error message and start trying suggestions until it works for you.