Reputation: 535
I am migrating my previous deployment made with docker-compose to Kubernetes. In my previous deployment, some containers do have some data made at build time in some paths and these paths are mounted in persistent volumes. Therefore, as the Docker volume documentation states,the persistent volume (not a bind mount) will be pre-populated with the container directory content.
I'd like to achieve this behavior with Kubernetes and its persistent volumes, How can I do ? Do I need to add some kind of logic using scripts in order to copy my container's files to the mounted path when data is not present the first time the container starts ?
Possibly related question: Kubernetes mount volume on existing directory with files inside the container
Upvotes: 2
Views: 2258
Reputation: 101
I think your options are
FYI The subPath might be of interest too depending on your use case and PodPreset might help in streamlining the op across the fleet of your pods
HTH
Upvotes: 6