-
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
cgroup is not displayed as shared namespace in pod inspection #12765
Comments
@cdoern Interested in this one? |
sure @mheon I was dealing with the above PR which this issue seems to be related to. |
I think we need to decide what we want to happen when using |
The expected behaviour, as I understand it, is that all of the containers within the Pod should share the same cgroup namespace as the the Pod. Nothing about the parent cgroup namespace. @vrothberg @giuseppe do you agree? @haircommander @umohnani8 Is this how Kubernetes works? |
Kubernetes doesn't use the cgroup namespaces on cgroup v1. The cgroup namespace is used on cgroup v2 (and it defaults to Thinking more of it, I am not sure a cgroupns makes sense for a pod. I'd drop it from the default list. |
so @giuseppe what behavior would you expect from |
I don't think we should set the same cgroup for different containers. if the |
but currently all Either way we need to establish the difference between |
Do me --share=cgroup would mean that containers within the POD all share the same cgroups. --share without cgroup means they don't, IE Each container gets its own cgroup. Default should be --share=cgroup. Lets talk about this as the Water Cooler today. |
That doesn't sound correct. |
I cannot attend watercooler today because of travel but let me know what you decide @rhatdan @mheon I think as it currently stands we share the cgroup parent and not the actual cgroup NS. What does having the same cgroup parent mean for the containers in the pod as compared to just being in the same cgroup NS? I am not sure what the expected behavior is or if I am correct in my assumption here. |
sharing the same parent means all the containers end up under the same cgroup, e.g.:
not sharing the cgroup namespace, means each container sees something like:
I am not sure sharing the cgroupns makes any sense. Why would a container sees its cgroup paths as resolved from another container context like the following?
|
ok @giuseppe, I see some possible solutions here:
|
Keeping the same defaults as current (cgroup namespace unshared, pod cgroup shared) seems reasonable, let's just refine the CLI experience so that |
SGTM |
so to be clear, this bit: https://github.com/containers/podman/blob/main/libpod/runtime_ctr.go#L354-L388 needs to be modified to utilize the |
I don't think https://github.com/containers/podman/blob/main/libpod/runtime_ctr.go#L354-L388) should be changed. It sets the cgroup and it should not look at Correct, |
@mheon debating making |
I don't feel like mixing namespaces and shared cgroups in the same flag is a good idea, but it is names |
okay, so then should I take the current |
I don't believe users would see the difference that we do. So I would go for --share cgroups. |
we already have If we go the As Matt pointed out though, I also find it confusing. Perhaps it should be |
This has to be a pod create option not a container run option... right? Yesterday at watercooler we discussed that we are going to have |
Yeah, pod create option. |
separated cgroupNS sharing from setting the pod as the cgroup parent, made a new flag --share-parent which sets the pod as the cgroup parent for all containers entering the pod remove cgroup from the default kernel namespaces since we want the same default behavior as before which is just the cgroup parent. resolves containers#12765 Signed-off-by: cdoern <[email protected]> Signed-off-by: cdoern <[email protected]> Signed-off-by: cdoern <[email protected]>
separated cgroupNS sharing from setting the pod as the cgroup parent, made a new flag --share-parent which sets the pod as the cgroup parent for all containers entering the pod remove cgroup from the default kernel namespaces since we want the same default behavior as before which is just the cgroup parent. resolves containers#12765 Signed-off-by: cdoern <[email protected]> Signed-off-by: cdoern <[email protected]> Signed-off-by: cdoern <[email protected]>
separated cgroupNS sharing from setting the pod as the cgroup parent, made a new flag --share-parent which sets the pod as the cgroup parent for all containers entering the pod remove cgroup from the default kernel namespaces since we want the same default behavior as before which is just the cgroup parent. resolves containers#12765 Signed-off-by: cdoern <[email protected]> Signed-off-by: cdoern <[email protected]> Signed-off-by: cdoern <[email protected]>
Is this a BUG REPORT or FEATURE REQUEST? (leave only one on its own line)
/kind bug
Description
podman help pod create
displayscgroup
as one of default values of--share
flag, which specifies shared namespaces in a pod. However,cgroup
is not listed inSharedNameSpaces
of a pod with default values. Even ifcgroup
is explicitly specified in--share
flag,cgroup
is not listed in a result ofpodman pod inspect
and actually containers in a pod don't share a cgroup namespace. Regarding other options for--share
such as ipc and net, specified values to--share
are displayed asSharedNameSpaces
inpodman pod inspect
.In the source code, there are two similar parameters for cgroups in a pod. When
cgroup
is specified in--share
,PodConfig.UsePodCgroup
is set totrue
. ForSharedNameSpaces
in pod inspection,PodConfig.UsePodCgroupNS
is referred to. There are two resources shared in a pod regarding cgroup, a cgroup parent and a cgroup namespace:PodConfig.UsePodCgroup
istrue
, a cgroup parent is shared in a pod, so that all containers in the pod have the same cgroup parent.PodConfig.UsePodCgroupNS
istrue
, a cgroup namespace is shared in a pod, so that all containers in the pod join the same cgroup namespace though this flag is currently never set.There are some options for the issue:
cgroup
inSharedNameSpaces
inpodman pod inspect
based onPodConfig.UsePodCgroup
. Another change is required if it is necessary to share a cgroup namespace, which is currently not shared.PodConfig.UsePodCgroupNS
. Another fix is required for sharing a cgroup parent.Steps to reproduce the issue:
Describe the results you received:
"cgroup" is not included in the result:
Describe the results you expected:
"cgroup" is included in the result:
Additional information you deem important (e.g. issue happens only occasionally):
Output of
podman version
:Output of
podman info --debug
:Package info (e.g. output of
rpm -q podman
orapt list podman
):Have you tested with the latest version of Podman and have you checked the Podman Troubleshooting Guide? (https://github.com/containers/podman/blob/master/troubleshooting.md)
Yes
Additional environment details (AWS, VirtualBox, physical, etc.):
The text was updated successfully, but these errors were encountered: