Directories creation inside the Kubernetes Persistent Volume

6/7/2017

How would we create a directory inside the kubernetes persistent volume to mount to use in the container as subPath ? eg: mysql directory should be created while claiming the persistent volume

-- RahulKrishnan R A
kubernetes

1 Answer

6/7/2017

I would probably put an init container into my podspec that simply mounts the volume and runs a mkdir -p to create the directory and then exit. You could also do this in the target container itself with some kind of script.

https://kubernetes.io/docs/concepts/workloads/pods/init-containers/

-- Brett Wagner
Source: StackOverflow