-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
generate kube with containers having volumes #2303
Comments
@ikke-t thanks for the issue, as you can see, we haven't implemented volumes for generate yet. perhaps you can help with some feedback ... can you describe your use case and what are your expectations on the Kubernetes side (besides saying it just works). should the yaml describe the volume, create it, etc? |
Damned this became long story. TL;DR: I wanted to save pod+containers as yaml to create ansible template out of AWX. Totally personal selfish reason, scratching my own itch. I'm happy to do so :) I'll explain my use case. I have been running Ansible AWX at home for practising at the beginning, and later on just keeping up my personal systems at home and some demo environments. I was also super curious about podman. AWX runs on spare laptop, so no kubernetes environment. So after changing some containers already to podman, it was AWX turn. That is of a kind that has 4 containers communicating with each other, and sharing volumes. So ideal for a single pod from my mind. Now that podman finally could do the networking parts also, I decided to give it a go. But AWX exports one port from containers, so I can't build it using podman commands because podman can expose ports only once, and I couldn't figure out how to do that with podman pod create + putting the containers it. So I need the yaml in order to get AWX started with podman. After I saw this blog: https://developers.redhat.com/blog/2019/01/29/podman-kubernetes-yaml/ I thought that's supercool way to get them all into yaml. I don't need to figure out all the options what to write, and format, I just start the pod manually and shovel the containers in, and export the yaml and that way get the whole pod+containers as one yaml. Then I can add the networking parts to the template. At this phase I run into this shortcoming, as generate kube couldn't export settings as yaml while containers had mounts exported. So it's not biggie, I can add the volume mounts manually afterwards. And will do, once the other issue (bug #2304 ) get's fixed and I can export anything at all to begin with. Damned this became long story. Point being, I needed the yaml to create ansible template out of that, which I could've contributed back to AWX for such single node servers. I suppose this is very handy path from docker containers to podman, at least for me it would be. Creating yaml from scratch isn't fun. All in all, this is not for kubernetes at all. One just needs the yaml in case containers within the pod export ports. As stated in that blog, they need to be described to podman at once, not one at the time in separate commands: https://developers.redhat.com/blog/2019/01/15/podman-managing-containers-pods/
Or then, I just misunderstood, which is very likely. |
@ikke-t thanks for the information. it is helpful that you took the time as it helps me understand what folks are trying to do and why. Would you mind clarifying with a little verbosity this one statement in your excellent response?
|
With that one I need guidance in deed :) This is my temp hack to see what AWX installer does with docker install. I modified this: https://github.com/ansible/awx/blob/devel/installer/roles/local_docker/tasks/standalone.yml to be run with podman, until I couldn't figure out how to get the exposed port to get visible from host:
Never mind the playbook being ugly, I just try to get the containers running so I can get the yaml out of it. I removed the volumes to get past this issue we are discussing. There is port expose for ansible_web. It fails with this:
And reading the blog, it seems the expose would need to be done at the time of setting the infra container. Which gets created at the time of pod create. Like blog says, it fails if tried exposing port after infra container is created. And if I move that port expose to infra container, for pod create, it won't pass the traffic to ansible_web container. So my thought was, that it probably works putting all that to yaml, so podman can do the right thing at once while setting up the pod from yaml file, instead of separate commands. Is my logic right? |
btw, the container and pod inspect are printed out in case #2304 |
I'm not aware that anything would have been done to fix this. I just explained my use case. Could be that it gets closed/won't fix if I'm alone with my use case :) |
do'h, I feel dumb now. I only realised now that podman can't read back the yamls itself. All the time I was thinking I create yaml file for awx containers for single pod. And that could be stored to e.g. I don't see such E.g, this would be the systemd file:
and podman config for the pod would be like this:
That would be nice way to configure pods. Compare to putting all those options to systemd file. This is BTW missing the volume mounts. This would be something in between k8s and docker compose for simple hosts only having podman. |
That sounds like |
thanks, I thought I saw somewhere that I could run the yaml with podman. Doesn't work on my fedora though, no such option in
that version doesn't have "play" sub command. Is it in some other package? |
...Huh. The code's been merged since December, so I'm rather curious as to why it's not there... |
and for the mount, in this case it should be (from ansible), so it saves both AWX stuff and posgres data:
This is the use case for this particular issue I was looking for. |
I downloaded that version today from Koji: https://koji.fedoraproject.org/koji/packageinfo?packageID=26289, the latest. This is Fedora 29. |
not there:
|
Just built from master, it's missing there too. |
Also, how did our tests miss an entire command going missing? |
podman play --help works. |
@rhatdan, it is not there, no matter how you put the help switch:
The play just doesn't seem to exist:
|
Or, am I missing some dependency lib or something? Like said, this is Fedora 29 with podman downloaded from Koji by dnf. Would it need some forgotten dependency library for play to become active? |
Well we are cutting the release of podman 1.1 today. So it will be in there. |
I think we are partially there. PR #2575 should complete. |
we're blocked on generate by some backend work by @mheon . I will come back once that comes down the pike |
@haircommander Didn't you fix this? |
No that was on play kube. @mheon's volume stuff landed though so I can take a stab at this now |
+1 :) |
@haircommander updates on this? |
@baude nope I have yet to "take a stab at it" |
We can open this up for an intern? |
SGTM |
@baude bumping this a hair, and jumping back to one of your original questions. In my mind, the output yaml would include a PVC for /mnt. Then, it would let Kubernetes handle satisfying that need at runtime. Make sense? For example, if I typed: podman run -dt -v /mnt/fred:/mnt/data quay.io/fatherlinux/two-pizza podman generate kube -l (for shorthand) I would expect it to add the following to the Deployment or Replication Controller: ... And, the following persistent volume claim: kind: PersistentVolumeClaim I wouldn't feel bad about setting size to 10G and letting the user customize from there (manually in an editor). |
WDYT @haircommander ^^ |
@fatherlinux does the 10G default originate from somewhere or is it just a chosen value? Seems a bit steep for a default, unless it's well defined for k8s PVC |
/kind feature
Description
I was trying to create Ansible AWX pod with few containers in it and export it as kube yaml. I succeeded putting containers into pod, but "podman generate kube awx" fails due not implemented volume export. So I can't export such pod into yaml.
Steps to reproduce the issue:
Generate pod ( --name awx)
add containers into pod with -v /tmp/volume:/volume:z
do podman generate kube awx
Describe the results you received:
$ sudo podman generate kube awx
volume names: not yet implemented
Describe the results you expected:
I would have expected awx.yaml file with info about 4 different containers.
Additional information you deem important (e.g. issue happens only occasionally):
Happens always.
Output of
podman version
:This is on Fedora 29
Output of
podman info
:Additional environment details (AWS, VirtualBox, physical, etc.):
Fedora 29 up to date on laptop.
The text was updated successfully, but these errors were encountered: