I have a storage provided by cloud provider. It's able to mount the storage to container via PVC.
Is there any way to specify the subpath of the disk then mounting to specific path of container.
I tried the custom values as below, but it does not work.
Persistence:
Enabled: true
## A manually managed Persistent Volume and Claim
## Requires Persistence.Enabled: true
## If defined, PVC must be created manually before volume will be bound
ExistingClaim: ci-jenkins-data
## jenkins data Persistent Volume Storage Class
## If defined, storageClassName: <storageClass>
## If set to "-", storageClassName: "", which disables dynamic provisioning
## If undefined (the default) or set to null, no storageClassName spec is
## set, choosing the default provisioner. (gp2 on AWS, standard on
## GKE, AWS & OpenStack)
##
# StorageClass: "-"
Annotations: {}
AccessMode: ReadWriteOnce
Size: 100Gi
volumes:
- name: ci-jenkins-data
mountPath: /var/jenkins_home
subPath: /volume/jenkins
Since one PVC can be claimed only once, Iam assuming you want to mount sub folders in volume in single pod. I have specified subpath in volumeMounts section as below.
apiVersion: v1
kind: Pod
metadata:
name: my-lamp-site
spec:
containers:
- name: mysql
image: mysql
env:
- name: MYSQL_ROOT_PASSWORD
value: "rootpasswd"
volumeMounts:
- mountPath: /var/lib/mysql
name: site-data
subPath: mysql
- name: php
image: php:7.0-apache
volumeMounts:
- mountPath: /var/www/html
name: site-data
subPath: html
volumes:
- name: site-data
persistentVolumeClaim:
claimName: my-lamp-site-data
Above snippet is copied from https://kubernetes.io/docs/concepts/storage/volumes/#using-subpath
Iam sure you might have tried hostpath however 1.9 raw block volume support may help your case.
Let me know if this helps or not.
Regards Sudhakar