New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
podman kube play
support for data volume container podman run --volume-from
#16819
Comments
Would an init container work for this use case? I think they would get started, but you could simply have them exec /bin/true. |
But wouldn't it be better to just define the volumes in the kube yaml? |
The data volume container images do not contain any runtime environment. So, exec to sh/true will fail. If we were to specific the volumes in the YML, then those data volume containers need to be created, inspect their volumes and then specify in the YML. Whereas, with Docker Compose I can specify the application and data volume containers all in the same YML with service dependencies setup in there itself. The Docker Compose can just create (not start) the data volume containers and bind mount all the volumes to the application container. I am looking for equivalent in podman kube. |
Podman kube uses kubernetes.yaml so the equivalent would be how kubernetes handles volumes. There is nothing specific about podman use of kubernetes.yaml. With k8s volumes there is no need to specify a container with a volume. But maybe I don't under stand, are you saying that a container image comes with data stored in its image that other containers they use? Could you point at an example of a "volume container"? |
I understand your point of k8 yaml and volumes. My use case is more of general available There are a variety of use cases for the data volume container image. For example, one use case is to bundle the orchestration scripts for life cycle management of the containers. The other being bundling some (on-demand, out-of-band) plugins such as some library files to extend the capability of an application without having to recreating the application image for every such use-case. |
Well we can not directly change the kubernetes.YAML file in a way that would break k8s. We could add ANNOTATIONS, which we have added in the past and then make podman kube play work differently when it sees these annotations. |
Look for annotations mentions in the podman kube play man page. |
Use of annotation and restriction to Podman environment are absolutely fine. To reiterate the use-case,
|
I wonder if an image volume would help with this. Currently Podman supports image volumes, which is somewhat similar. |
Is there a sample podman kube YML file for the image volumes that satisfies the use case? |
Is there an update? |
A friendly reminder that this issue had no activity for 30 days. |
@ygalblum @umohnani8 WDYT? |
Been a while. Checking if there is any update. |
Best way to move something forward is to open a PR. |
Sure. Any pointers where to start with? |
Take a look at cmd/podman/create and see how we pass in --volume-from to start and then port this to cmd/podman/kube. Does Kubernetes have some concept of this? |
I'm not sure if I understand the requirement. So, I'll first repeat what I understood. The requirement is to mount a container image as a volume. Is this correct? If yes, then the way to achieve this today is by creating a volume:
Please note that In addition, since the question is about Once it's merged and released, you will be able to create image based volumes using PVCs. For example:
Please let me know if this addresses the issue, or if I misunderstood the request altogether. |
@rhatdan as for your question about K8S, I don't know that it is supported for pods. I do know that in KubeVirt users can use container images for storing the |
I checked the image volume option. It is not an alternative of
|
@rhatdan , Under For example,
The respective code change would be as below. In abi.playKubePod() -> kube.InitializeVolumes() returns a list of volumes-from container names (#L613) https://github.com/containers/podman/blob/main/pkg/specgen/generate/kube/volume.go#L288 -> playKubePod() sets a new VolumesFrom in the kube.CtrSpecGenOptions struct (#L789,#L865) -> kube.ToSpecGen() in turn sets the VolumesFrom in the specgen.SpecGenerator struct (#L811,#L892) https://github.com/containers/podman/blob/main/pkg/specgen/generate/kube/kube.go#L184 -> generate.MakeContainer() handles the VolumesFrom option (#L827,#L908) |
@vikas-goel the example you have from #16819 (comment), does that work in a k8s cluster? With adding supporting for this behavior we don't want to end up breaking portability to a k8s cluster. |
The way I look at it is the k8s cluster yaml works in podman. The podman kube yaml, regardless of the change in the example, may or may not work. That is, the same desired effect may not be seen as the podman specific annotations and customization will be disregarded by k8s. |
@umohnani8 @vikas-goel First, clearly this YAML will not work on a K8S cluster because the feature of instructing K8S to mount volumes defined on one container on a different one does not exits. Furthermore, the schema of the value |
Is this a BUG REPORT or FEATURE REQUEST? (leave only one on its own line)
/kind feature
Description
We have a use-case of data volume container where such containers are created but never started. The volumes of these containers are then bind mounted to an application container using
--volumes-from
option. Docker Compose supports this deployment. In order to move to Podman kube, we need this use-case supported.Does
podman kube play
support it?The text was updated successfully, but these errors were encountered: