Joining CNI networks if running rootless
Is this a BUG REPORT or FEATURE REQUEST?
/kind feature
Description
With Podman, it would be useful to be able to mix rootfull and rootless containers from a networking perspective. For example, a use case would be to run one rootfull container as reverse proxy (that exposes ports 80 and 443) in order to manage traffic to any number of non-root containers in the backend. This does not work at this point in time and according to @rhatdan there is no discussion going on around this either. Hence this issue.
Steps to reproduce the issue:
- Create a network
# podman network create customer
- Deploy a rootfull container
# podman run -d --network=customer --name proxy -p 80:80 -p 443:443 docker.io/library/nginx:alpine
- Try to connect a rootless container to the same network.
$ podman run -d --network=customer --name secure-app docker.io/library/nginx:alpine
Describe the results you received:
The following error:
Error: cannot join CNI networks if running rootless: invalid argument
Describe the results you expected:
Rootfull and rootless containers can join the same network and communicate.
Output of podman version:
Version: 3.0.0-dev
API Version: 3.0.0
Go Version: go1.15.7
Built: Tue Feb 2 23:06:33 2021
OS/Arch: linux/amd64
Output of podman info --debug:
Unrelated.
Package info (e.g. output of rpm -q podman or apt list podman):
podman-3.0.0-0.33rc2.module_el8.4.0+673+eabfc99d.x86_64
Have you tested with the latest version of Podman and have you checked the Podman Troubleshooting Guide?
Yes
Additional environment details (AWS, VirtualBox, physical, etc.):
Unrelated
If you do a podman network create <network_name>, that will work. As for being able to mix rootfull and rootless containers, there are other viable options today and using iptables might also get the job done?
@baude Don't think iptables will do any good. The rootless networks are confined to a rootless network namespace, separated from the rest of the system - other users can't even see that they exist. This is a necessary consequence of running rootless Podman, where we don't have the privileges to do networking normally. As such, there is no way for root and rootless containers to share traffic except by passing it over the host (e.g. root container binds to localhost:8000, rootless container connects to 8000 on the host's IP).
I asked @koep to open this issue to see if @baude, @mheon, @AkihiroSuda, @giuseppe and @mccv1r0 would have any ideas.
it is a fair ask, but for bridged networks, I dont think it is possible. this could be done with macvlans i would venture.
I doubt we have permissions to run macvlan as rootless, though.
This is a case where lxc-user-nic would really come in handy - if we actually had a setuid way to configure rootless networking we could work around many of these restrictions.
yeah, it doesnt work, just tested to be sure
A friendly reminder that this issue had no activity for 30 days.
I think this can be implemented in sudo podman network connect.
I don't think rootless podman run can have ability to join rootful CNI.
A friendly reminder that this issue had no activity for 30 days.
I think this should be closed as one cannot mix rootless and rootful networks.