You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
cAdvisor in Kube 1.4 is broken on RHEL systems when running in a container - cgroup is out of order #1461
This is from the 1.4 cAdvisor (or just before?) - when mounted in a container cadvisor sees a different cgroup path, which causes cAdvisor to quick. Breaks containerized kubelet using -v /sys:/sys mounts.
@smarterclayton Yeah, the system order is different from what we see in the container when we bind mount /sys over /sys. IMO, cadvisor should check which path exists and set the inotify watch accordingly.
IIRC, this was fixed via a libcontainer update. Libcontainer was mounting
cgroups with non-identify mappings inside the container. I'm surprised this
is showing up in k8s v1.4.0
On Wed, Sep 14, 2016 at 3:03 PM, Mrunal Patel [email protected]
wrote:
Now, when we bind mount /sys:/sys we are overwriting that with the order on the system which happens to be the opposite on RHEL and hence the issue.
One thing that cadvisor could do is not use combined paths as symlinks are provided for each subsystem to a combined path.
cAdvisor uses libcontainer to identify the mount points. IIRC, libcontainer
used the first set of mount paths it identifies. I don't have time to dig
into it now, but in essence, libcontainer should be able to pick the right
set of mount points.
On Wed, Sep 14, 2016 at 3:22 PM, Mrunal Patel [email protected]
wrote:
Now, when we bind mount /sys:/sys we are overwriting that with the order
on the system which happens to be the opposite on RHEL and hence the issue.
One thing that cadvisor could do is not use combined paths as symlinks are
provided for each subsystem to a combined path.
@vishh Yes, libcontainer looks at the first mount points that it finds. How is cadvisor expected to be launched in a container? What host paths are expected to be mounted inside? This will help identify how to fix this.
@vishh I went through the code and I think it will be easier if we discuss this over a call. What you really want is the later mount point from mountinfo but that isn't always the correct assumption that could be made in libcontainer especially when nesting containers (like docker-in-docker).
On Wed, Sep 14, 2016 at 4:48 PM, Mrunal Patel [email protected]
wrote:
@vishhhttps://github.com/vishh I went through the code and I think it
will be easier if we discuss this over a call. What you really want is the
later mount point from mountinfo but that isn't always the correct
assumption that could be made in libcontainer especially when nesting
containers (like docker-in-docker).
I propose that we enhance the libcontainer API to allow getting all the mounts in order. Then it is up to the caller to use them in whatever way they see fit. See opencontainers/runc@5e91f1c cadvisor could just pick the later entries and it should all work fine.
Given the ordering of the mount points, cAdvisor when iterating them will get the proper items in its map by virtue of its iteration order in the slice as desired.
Do we need this in k8s v1.4 / cAdvisor v0.24? The cAdvisor release was supposed to be cut today, but I held it back. If so, please get approval for cherrypicking into k8s v1.4 first.
@mrunalp What do you mean by "Now, when we bind mount /sys:/sys we are overwriting that with the order on the system which happens to be the opposite on RHEL and hence the issue?"
this is fixed now, take a look at the PR and should be clear. If your host
had cpu,cpuacct but inside the container it was always looking for
cpuacct,cpu independent of what the host had since it didn't look at all
mountpoints. So if your OS had sys/fs/cgroup/ setup in the opposite order,
you would hit this.
Activity
smarterclayton commentedon Sep 14, 2016
@derekwaynecarr @ncdc @mrunalp correct me if I got any of that wrong.
mrunalp commentedon Sep 14, 2016
@smarterclayton Yeah, the system order is different from what we see in the container when we bind mount /sys over /sys. IMO, cadvisor should check which path exists and set the inotify watch accordingly.
vishh commentedon Sep 14, 2016
IIRC, this was fixed via a libcontainer update. Libcontainer was mounting
cgroups with non-identify mappings inside the container. I'm surprised this
is showing up in k8s v1.4.0
On Wed, Sep 14, 2016 at 3:03 PM, Mrunal Patel [email protected]
wrote:
mrunalp commentedon Sep 14, 2016
@vishh This is what libcontainer mounts inside a container (for e.g.):
Now, when we bind mount /sys:/sys we are overwriting that with the order on the system which happens to be the opposite on RHEL and hence the issue.
One thing that cadvisor could do is not use combined paths as symlinks are provided for each subsystem to a combined path.
Not sure how we can fix this in libcontainer.
vishh commentedon Sep 14, 2016
cAdvisor uses libcontainer to identify the mount points. IIRC, libcontainer
used the first set of mount paths it identifies. I don't have time to dig
into it now, but in essence, libcontainer should be able to pick the right
set of mount points.
On Wed, Sep 14, 2016 at 3:22 PM, Mrunal Patel [email protected]
wrote:
timstclair commentedon Sep 14, 2016
Is this the same as #1444?
mrunalp commentedon Sep 14, 2016
@vishh Yes, libcontainer looks at the first mount points that it finds. How is cadvisor expected to be launched in a container? What host paths are expected to be mounted inside? This will help identify how to fix this.
vishh commentedon Sep 14, 2016
It expects all the cgroups mounts from the host to be mounted. It uses
libcontainer to detect the cgroup mounts.
On Wed, Sep 14, 2016 at 4:10 PM, Mrunal Patel [email protected]
wrote:
mrunalp commentedon Sep 14, 2016
@vishh with a -v /sys:/sys:ro ?
mrunalp commentedon Sep 14, 2016
@vishh I went through the code and I think it will be easier if we discuss this over a call. What you really want is the later mount point from mountinfo but that isn't always the correct assumption that could be made in libcontainer especially when nesting containers (like docker-in-docker).
vishh commentedon Sep 15, 2016
sgtm!
On Wed, Sep 14, 2016 at 4:48 PM, Mrunal Patel [email protected]
wrote:
UPSTREAM: google/cadvisor: <drop>: Hack around cgroup load
UPSTREAM: google/cadvisor: <drop>: Hack around cgroup load
mrunalp commentedon Sep 15, 2016
I propose that we enhance the libcontainer API to allow getting all the mounts in order. Then it is up to the caller to use them in whatever way they see fit. See opencontainers/runc@5e91f1c cadvisor could just pick the later entries and it should all work fine.
UPSTREAM: google/cadvisor: <drop>: Hack around cgroup load
derekwaynecarr commentedon Sep 15, 2016
I spoke w/ @mrunalp and we want to proceed as follows:
Given the ordering of the mount points, cAdvisor when iterating them will get the proper items in its map by virtue of its iteration order in the slice as desired.
UPSTREAM: google/cadvisor: <drop>: Hack around cgroup load
UPSTREAM: google/cadvisor: <drop>: Hack around cgroup load
timstclair commentedon Sep 16, 2016
Do we need this in k8s v1.4 / cAdvisor v0.24? The cAdvisor release was supposed to be cut today, but I held it back. If so, please get approval for cherrypicking into k8s v1.4 first.
timstclair commentedon Sep 16, 2016
@pwittrock in case we need this for v1.4
timstclair commentedon Sep 16, 2016
@eparis
eparis commentedon Sep 16, 2016
@timstclair I think yes. Which means maybe you get the cadvisor rebase after all :)
derekwaynecarr commentedon Sep 16, 2016
I didn't think this needed to gate 1.4 as it only impacts running cAdvisor or Kubelet in a container... /cc @eparis @dawnchen
dchen1107 commentedon Sep 16, 2016
Agreed with @derekwaynecarr on that this shouldn't be the blocker for 1.4 release.
UPSTREAM: google/cadvisor: <drop>: Hack around cgroup load
philips commentedon Sep 21, 2016
@mrunalp What do you mean by "Now, when we bind mount /sys:/sys we are overwriting that with the order on the system which happens to be the opposite on RHEL and hence the issue?"
derekwaynecarr commentedon Sep 23, 2016
this is fixed now, take a look at the PR and should be clear. If your host
had cpu,cpuacct but inside the container it was always looking for
cpuacct,cpu independent of what the host had since it didn't look at all
mountpoints. So if your OS had sys/fs/cgroup/ setup in the opposite order,
you would hit this.
On Wednesday, September 21, 2016, Brandon Philips <[email protected]
javascript:_e(%7B%7D,'cvml','[email protected]');> wrote:
soleil0-0 commentedon Oct 9, 2016
Here is the solution that works kubernetes/kubernetes#32728 (comment)
nnordrum commentedon Oct 13, 2016
Assuming you're running in docker, you can do this too:
I just took the example from the front page and added this:
Works like a champ!