Hi, I am a new comer to k8s, I have a question about volume usage in k8s.--From Docker Docs, there is a feature described in data volumes:
- Volumes are initialized when a container is created. If the container’s base image contains data at the specified mount point, that existing data is copied into the new volume upon volume initialization. (Note that this does not apply when mounting a host directory.)
Use the docker command, it will be `$ docker run -d -P --name web -v /webapp training/webapp python app.py`. And the data in the path `/webapp` will be copied to somewhere in the host without empty it.How to implement this when using k8s. I tried `hostPath`, `PersistentVolumeClaim`, and they all load an empty directory to my mount point. Any suggestions?Thank you for your time.
You received this message because you are subscribed to the Google Groups "Kubernetes developer/contributor discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to kubernetes-dev+unsubscribe@googlegroups.com.
To post to this group, send email to kubernetes-dev@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/kubernetes-dev/6a0ffdd6-6180-4b8c-910f-d3236dd8802a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Can you say more about hat you are trying to achieve?
On Jun 20, 2017 8:31 PM, "Hanks Justin" <zhouh...@gmail.com> wrote:
Hi, I am a new comer to k8s, I have a question about volume usage in k8s.--From Docker Docs, there is a feature described in data volumes:
- Volumes are initialized when a container is created. If the container’s base image contains data at the specified mount point, that existing data is copied into the new volume upon volume initialization. (Note that this does not apply when mounting a host directory.)
Use the docker command, it will be `$ docker run -d -P --name web -v /webapp training/webapp python app.py`. And the data in the path `/webapp` will be copied to somewhere in the host without empty it.How to implement this when using k8s. I tried `hostPath`, `PersistentVolumeClaim`, and they all load an empty directory to my mount point. Any suggestions?Thank you for your time.
You received this message because you are subscribed to the Google Groups "Kubernetes developer/contributor discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to kubernetes-dev+unsubscribe@googlegroups.com.
To post to this group, send email to kuberne...@googlegroups.com.
To unsubscribe from this group and stop receiving emails from it, send an email to kubernetes-de...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/kubernetes-dev/CA%2BB74UrFMSfL8LQ6mTBq8nbdAjxUce4v7aor%2B0%3DGUbbNO9Qokg%40mail.gmail.com.
In intent, this seems is a small use case out of the broader "I want to be able to use content out of another image or container" feature (which has been discussed for a long time). Ie "I want an empty dir which has the contents of an image directory by default".The biggest challenge to that feature is the limitations of docker's current API (an images filesystem is complex to construct without creating and managing a container) and the open question about where we might want to go in the future (should mounting a directory from a container that exposes a fuse filesystem be considered part of the same feature). But I do think there is a lot of desire to make such a feature happen.
@thockin Thank you for your reply. Here is my usage, I have a data pre-populated postgresql image with a volume path set on `/var/lib/postgresql/data`, and I want to the data copied to the somewhere automatically when I create pod.From Docker usage, [If the container’s base image contains data at the specified mount point, that existing data is copied into the new volume upon volume initialization], when I use `docker run -d -P --name db -v /var/lib/potgresql/data`, the data pre-populated in `/var/lib/potgresql/data` can be copied to a path in host.So how to use k8s to achieve this, I tried volume settings, like `hostPath` and `PersistentVolumeClaim`, But they all override the data in path `/var/lib/potgresql/data`, with making it empty.Thank you for your time.
On Sun, Jul 2, 2017 at 8:32 AM, Tim Hockin <tho...@google.com> wrote:
Can you say more about hat you are trying to achieve?
On Jun 20, 2017 8:31 PM, "Hanks Justin" <zhouh...@gmail.com> wrote:
Hi, I am a new comer to k8s, I have a question about volume usage in k8s.--From Docker Docs, there is a feature described in data volumes:
- Volumes are initialized when a container is created. If the container’s base image contains data at the specified mount point, that existing data is copied into the new volume upon volume initialization. (Note that this does not apply when mounting a host directory.)
Use the docker command, it will be `$ docker run -d -P --name web -v /webapp training/webapp python app.py`. And the data in the path `/webapp` will be copied to somewhere in the host without empty it.How to implement this when using k8s. I tried `hostPath`, `PersistentVolumeClaim`, and they all load an empty directory to my mount point. Any suggestions?Thank you for your time.
You received this message because you are subscribed to the Google Groups "Kubernetes developer/contributor discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to kubernetes-de...@googlegroups.com.
To post to this group, send email to kuberne...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/kubernetes-dev/6a0ffdd6-6180-4b8c-910f-d3236dd8802a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups "Kubernetes developer/contributor discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to kubernetes-de...@googlegroups.com.
To post to this group, send email to kuberne...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/kubernetes-dev/e946dc22-e94b-4ad0-8bb2-f9513e5c54d3%40googlegroups.com.