Skip to content

Shim: Add support for cgroups v2 stats #11472

@Champ-Goblem

Description

@Champ-Goblem

Description

Currently, the shim supports CRI stats interface but only uses the v1 version of metrics. This causes issues with gathering containerd-based workload metrics on CGroup V2 systems, where containerd expects the shim to return the V2 metrics https://github.com/containerd/containerd/blob/main/core/metrics/cgroups/cgroups.go#L85-L88.

When the two versions are mismatched, containerd errors about failing to gather metrics for a container:

level=error msg="invalid metric type for 86fae802d3432b33d9eb424efa5a7d1c57dd8fa1eb95eb7d49ebd262a860ea85" error="<nil>"

or

unmarshal stats for 468954f334603fe0e97efbf03f0eacd0143c1fe9d146c93eae4163a4f51f5041" error="can't unmarshal type \"io.containerd.cgroups.v1.Metrics\" to output \"io.containerd.cgroups.v2.Metrics\"

depending on the version of containerd used.

Steps to reproduce

No response

runsc version

docker version (if using docker)

uname

No response

kubectl (if using Kubernetes)

repo state (if built from source)

No response

runsc debug logs (if available)

Metadata

Metadata

Assignees

No one assigned

    Labels

    type: bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions