Skip to content

Support populating containerd labels with pod's metadata->labels? #52

@shapirus

Description

@shapirus

Currently, only a few hardcoded labels make it into the containerd container labels section, for example:

# ctr --address /run/containerd/containerd.sock -n k8s.io containers info e4d35794a41cb3998eef8b0cec0d233a64b021582fabee90885ef0aaaa767ebd
{
    "ID": "e4d35794a41cb3998eef8b0cec0d233a64b021582fabee90885ef0aaaa767ebd",
    "Labels": {
        "io.cri-containerd.kind": "container",
        "io.kubernetes.container.name": "xxxxx",
        "io.kubernetes.pod.name": "xxxxx-5658cff946-lkwdx",
        "io.kubernetes.pod.namespace": "yyyyy",
        "io.kubernetes.pod.uid": "c4d0196a-2d04-4841-917c-5f4aaaabe9b9"
    },

It makes it impossible to read custom labels defined in pod's metadata->labels for using them in metrics collection, for example, cadvisor, which has a bunch of related issues open: https://github.com/google/cadvisor/issues?q=is%3Aissue%20state%3Aopen%20in%3Atitle%20label%20

These labels are apparently hardcoded in https://github.com/kubernetes/kubelet/blob/master/pkg/types/labels.go

Would it be feasible to extend it to automatically add whatever is available in the metadata labels section?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions