Persisten volume can be provisioned as a subpath in juicefs filesystem.
Ensure you have already get familiar with static-provisioning example.
Patch the persistent volume spec with csi/volumeAttributes/subPath
. The subPath must pre-exist.
apiVersion: v1
kind: PersistentVolume
metadata:
name: juicefs-aws-us-east-1
spec:
csi:
volumeAttributes:
subPath: fluentd
Build the example with kustomize and apply with kubectl
kustomize build | kubectl apply -f -
or apply with kubectl >= 1.14
kubectl apply -k .
After the objects are created, verify that pod is running:
>> kubectl get pods
Also you can verify that data is written onto JuiceFS filesystem:
>> kubectl exec -ti juicefs-app -- tail -f /data/out.txt
Check that file is created under the subpath in JuiceFS console.