podman icon indicating copy to clipboard operation
podman copied to clipboard

Joining CNI networks if running rootless

Open koep opened this issue 5 years ago • 10 comments

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:

  1. Create a network
# podman network create customer
  1. Deploy a rootfull container
# podman run -d --network=customer --name proxy -p 80:80 -p 443:443 docker.io/library/nginx:alpine
  1. 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

koep avatar Feb 23 '21 09:02 koep

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 avatar Feb 23 '21 13:02 baude

@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).

mheon avatar Feb 23 '21 14:02 mheon

I asked @koep to open this issue to see if @baude, @mheon, @AkihiroSuda, @giuseppe and @mccv1r0 would have any ideas.

rhatdan avatar Feb 23 '21 19:02 rhatdan

it is a fair ask, but for bridged networks, I dont think it is possible. this could be done with macvlans i would venture.

baude avatar Feb 23 '21 19:02 baude

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.

mheon avatar Feb 23 '21 20:02 mheon

yeah, it doesnt work, just tested to be sure

baude avatar Feb 23 '21 21:02 baude

A friendly reminder that this issue had no activity for 30 days.

github-actions[bot] avatar Mar 26 '21 00:03 github-actions[bot]

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.

AkihiroSuda avatar Mar 26 '21 00:03 AkihiroSuda

A friendly reminder that this issue had no activity for 30 days.

github-actions[bot] avatar Apr 26 '21 00:04 github-actions[bot]

I think this should be closed as one cannot mix rootless and rootful networks.

baude avatar Jul 06 '21 14:07 baude