Error: failed to prepare subPath for volumeMount "site-data" of container "test-app"

12/18/2019

I need to deploy that need plenty of volumes from different directory so i'm currently trying to use the subpath feature in a nfs volume but i keep getting this error : Error: failed to prepare subPath for volumeMount "site-data" of container "test-app.

When i do not mention the "subpath" directive it's working properly. Also, on the nfs server, i can see that openshift create himself the subpath directory (so i assume that the directory is writable by the cluster).

Here is the detail :

Openshift version :

oc v3.11.0+0cbc58b
kubernetes v1.11.0+d4cacc0
features: Basic-Auth GSSAPI Kerberos SPNEGO

Server https://192.168.42.202:8443
kubernetes v1.11.0+d4cacc0

/etc/exports on the nfs server :

/tmp/datacontainer *(rw,no_root_squash,insecure) #testopenshift

Volume Information :

apiVersion: v1
kind: PersistentVolume
metadata:
  name: nfs-v242
spec:
  capacity:
    storage: 3Gi 
  accessModes:
  - ReadWriteMany 
  nfs: 
    path: /tmp/datacontainer
    server: 10.0.10.242
  persistentVolumeReclaimPolicy: Retain

Persistent volume claim :

apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  annotations:
  name: claimv242
  namespace: myproject
spec:
  accessModes:
  - ReadWriteMany
  resources:
    requests:
      storage: 2Gi
  volumeName: nfs-v242

Mount point section in my deployment :

  volumeMounts:
        - mountPath: /tmp/log
          name: site-data
          subPath: logdir
      volumes:
      - name: site-data
        persistentVolumeClaim:
          claimName: claimv242

Could someone help me with my issue ?

-- Axelinux
kubernetes
kubernetes-pvc
okd
openshift

0 Answers