containerd: make the cgroup pattern configurable - #3923
Open
eagletmt wants to merge 1 commit into
Open
Conversation
cAdvisor identifies containerd containers by matching the base name of a
cgroup against a hardcoded `([a-z0-9]{64})`. Deployments that do not name
cgroups after the 64 hex character container ID are therefore never
claimed by the containerd factory, and fall back to the raw factory,
which reports no image, name or labels for them.
AWS ECS Managed Instances is one such deployment: it runs containerd
under the `fargate.task` namespace and names container cgroups
`/ecs/<32 hex task id>/<32 hex task id>-<digits>`.
Add a `-containerd_cgroup_pattern` flag that overrides the regexp. It
defaults to the current pattern, so existing behaviour is unchanged. If
the pattern has a capturing group, the first submatch of the base name is
used as the containerd container ID; otherwise the base name itself is
used, which is what ECS Managed Instances needs because there the cgroup
base name already is the container ID.
Per-container metrics on ECS Managed Instances can then be collected
with:
```
cadvisor -containerd-namespace=fargate.task \
-containerd_cgroup_pattern='^[a-f0-9]{32}-[0-9]+$'
```
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
cAdvisor identifies containerd containers by matching the base name of a cgroup against a hardcoded
([a-z0-9]{64}). Deployments that do not name cgroups after the 64 hex character container ID are therefore never claimed by the containerd factory, and fall back to the raw factory, which reports no image, name or labels for them.AWS ECS Managed Instances is one such deployment: it runs containerd under the
fargate.tasknamespace and names container cgroups/ecs/<32 hex task id>/<32 hex task id>-<digits>.Add a
-containerd_cgroup_patternflag that overrides the regexp. It defaults to the current pattern, so existing behaviour is unchanged. If the pattern has a capturing group, the first submatch of the base name is used as the containerd container ID; otherwise the base name itself is used, which is what ECS Managed Instances needs because there the cgroup base name already is the container ID.Per-container metrics on ECS Managed Instances can then be collected with: