Skip to content

[CRI] The ListPodSandboxMetrics method in containerd is not yet implemented #10506

@mengjiao-liu

Description

@mengjiao-liu

What is the problem you're trying to solve

When I enable feature gate PodAndContainerStatsFromCRI in kubelet, according to the K8s code,

	if utilfeature.DefaultFeatureGate.Enabled(features.PodAndContainerStatsFromCRI) {
		r.CustomRegister(collectors.NewCRIMetricsCollector(context.TODO(), s.host.ListPodSandboxMetrics, s.host.ListMetricDescriptors))
	}
...

I should get the corresponding metrics in the /metrics/cadvisor, but I don't see the corresponding metrics output (e.g., CPU, memory, IO, etc.).

I did a deep dive and found that this method is not implemented in the containerd code.
https://github.com/containerd/containerd/blob/main/internal/cri/server/list_pod_sandbox_metrics.go#L27-L28

func (c *criService) ListPodSandboxMetrics(context.Context, *runtime.ListPodSandboxMetricsRequest) (*runtime.ListPodSandboxMetricsResponse, error) {
	return nil, status.Errorf(codes.Unimplemented, "method ListPodSandboxMetrics not implemented")
}

Describe the solution you'd like

ListPodSandboxMetrics can return the corresponding metrics data.

Additional context

I searched for it in the Kubernetes sig-node slack channel. It looks like it's in the process of adding support for ListPodSandboxMetrics? Does anyone know its current progress? @haircommander
/cc @dims @mikebrow @adisky

The slack channel information is as follows:
https://kubernetes.slack.com/archives/C0BP8PW9G/p1704866471387549?thread_ts=1695837043.386759&cid=C0BP8PW9G

Metadata

Metadata

Assignees

Labels

area/criContainer Runtime Interface (CRI)kind/featurestatus/roadmappedFeature has been accepted into the roadmap

Projects

Status

Done

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions