Skip to content

Per Container User Namespaces in Pod Quadlets? #26848

@connelhooley

Description

@connelhooley

Feature request description

I have 2 containers in a pod but I'd like to have one container map UID 33 to HUID 1000 and another container map UID 999 to HUID 1000.

If I try set UIDMap=+999:@%U in a .container file that is in a pod, I'm told I can't do that:

Error: cannot specify a new uid/gid map when entering a pod with an infra container: invalid argument

I can't specify this at a pod level as the mappings conflict.

I can see there is an option in podman pod create to create a pod that doesn't have an infra container. If I specify this in my .container quadlet, like this: PodmanArgs=--infra=false the setting is ignored. I'm assuming this is by design and not a bug, but if it isn't I can raise a bug instead of a feature request.

I can also see that there is an option in podman pod create to specify which namespaces to share. If I specify that in my .container quadlet like this PodmanArgs=--share="net" I still get the same error referring to the infra container above (even though I'm trying to opt out of the shared user namespace). The share option is a little strange in that it only supports these namespaces "cgroup, ipc, net, pid, uts". User isn't mentioned.

Another semi-related gotcha with the current design is that ShmSize is ignored when set on a container that is in a pod. This isn't a big deal but was unintuitive and it would be great to have more control over what is shared in a pod and what isn't.

Suggest potential solution

Users should be able to specify per container user namespaces in pods.

When specifying PodmanArgs=--infra=false the value should either be applied correctly or the user should be given an error message explaining that quadlets don't support it and ideally why.

When specifying ShmSize=xxx for a container that is in a pod, the value should either be applied correctly at a container level or the user should be given an error message explaining that containers must have the value set at the pod level.

Have you considered any alternatives?

I think the alternative is to share a network instead of being in a pod and then create a service that depends on the containers so that I can start and stop the containers as a group. The downside of this approach is that I lose a lot of the benefits of pods like the UI in Cockpit (I like the hardware usage overview of each pod).

It would feel like I'm recreating some of pod's functionality manually just to have a bit more control of host user ids.

Additional context

I'm still very new to Podman and Linux namespaces so maybe what I'm asking for makes no sense given how pods actually work but the option is there to turn off the infra container and configure the shared namespaces so hopefully something is possible.

Metadata

Metadata

Assignees

Labels

Good First IssueThis issue would be a good issue for a first time contributor to undertake.kind/featureCategorizes issue or PR as related to a new feature.stale-issuetriagedIssue has been triaged

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions