-
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
Feature request: support ns namespace path network option for pods #16208
Comments
I see no reason why this is restricted, it should be simple to add this functionality. |
I agree, the check blocking it should be removed. |
I would like to give this one a try. I got ./bin/podman pod inspect $(./bin/podman pod create --network ns:$(mktemp -d))
{
"Id": "e81c95b5d4e6e1f3f202275ac320490c9e889b5e2c53b4c65eb1905938eb56d4",
"Name": "epic_darwin",
"Created": "2022-11-02T11:40:25.31129367+01:00",
"CreateCommand": [
"./bin/podman",
"pod",
"create",
"--network",
"ns:/tmp/tmp.7YMHiBxEIg"
],
"ExitPolicy": "continue",
"State": "Created",
"Hostname": "",
"CreateCgroup": true,
"CgroupParent": "user.slice",
"CgroupPath": "user.slice/user-libpod_pod_e81c95b5d4e6e1f3f202275ac320490c9e889b5e2c53b4c65eb1905938eb56d4.slice",
"CreateInfra": true,
"InfraContainerID": "75d55cc88da22a2a4924df499141c470992062cd43d7f1a6196c114f2681808e",
"InfraConfig": {
"PortBindings": {},
"HostNetwork": false,
"StaticIP": "",
"StaticMAC": "",
"NoManageResolvConf": false,
"DNSServer": null,
"DNSSearch": null,
"DNSOption": null,
"NoManageHosts": false,
"HostAdd": null,
"Networks": null,
"NetworkOptions": null,
"pid_ns": "private",
"userns": "host",
"uts_ns": "private"
},
"SharedNamespaces": [
"ipc",
"net",
"uts"
],
"NumContainers": 1,
"Containers": [
{
"Id": "75d55cc88da22a2a4924df499141c470992062cd43d7f1a6196c114f2681808e",
"Name": "e81c95b5d4e6-infra",
"State": "created"
}
]
} |
Inspect the infra container, it should show Note that mkdir is not a valid netns fd. What you actually want to test is something like this:
The last command should show you an empty netns (only the lo interface)
and then again, this should now also include the dummy interface.
|
I am not familiar with network namespaces, but how it looks like it is working? $ sudo ./bin/podman pod create --name netnspod --network ns:/var/run/netns/podman --infra-image=alpine --infra-command 'ip a'
07ce95e993abe4a34a1476be7c7c2b4a3a3fd15dbb729d120f46832b8d683076
$ sudo podman pod ls
POD ID NAME STATUS CREATED INFRA ID # OF CONTAINERS
07ce95e993ab netnspod Created 7 seconds ago d0cdc09a198e 1
$ sudo podman pod start netnspod
07ce95e993abe4a34a1476be7c7c2b4a3a3fd15dbb729d120f46832b8d683076
$ sudo podman logs d0cdc09a198e
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN qlen 1000
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
3: veth1@veth0: <BROADCAST,MULTICAST,M-DOWN> mtu 1500 qdisc noop state DOWN qlen 1000
link/ether 16:45:c8:df:b0:b8 brd ff:ff:ff:ff:ff:ff
4: veth0@veth1: <BROADCAST,MULTICAST,M-DOWN> mtu 1500 qdisc noop state DOWN qlen 1000
link/ether be:92:29:58:bf:e9 brd ff:ff:ff:ff:ff:ff
$ sudo ip -n podman a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
3: veth1@veth0: <BROADCAST,MULTICAST,M-DOWN> mtu 1500 qdisc noop state DOWN group default qlen 1000
link/ether 16:45:c8:df:b0:b8 brd ff:ff:ff:ff:ff:ff
4: veth0@veth1: <BROADCAST,MULTICAST,M-DOWN> mtu 1500 qdisc noop state DOWN group default qlen 1000
link/ether be:92:29:58:bf:e9 brd ff:ff:ff:ff:ff:ff |
@Luap99 just saw your comment. When I inspect the infra container I do indeed get that:
|
Yes this looks good then, please open a PR. Make sure to add a test somewhere under test/e2e, you can grep for |
Closes containers#16208. Signed-off-by: Björn Mosler <[email protected]>
The option
where
[netns-path]
is the path of a network namespace to join, is supported when creating containers. But when trying to let a pod to be created the same way (namely to join an existing network pre-defined in the hosting context), it fails:My question is: is there future plan to add such a support (for pods)? It will be appreciated to have such a support to increase the networking flexibility of podman ... It is supported for containers why not for pods?
The text was updated successfully, but these errors were encountered: