kubernetes / kube-state-metrics

Add-on agent to generate and expose cluster-level metrics.
https://kubernetes.io/docs/concepts/cluster-administration/kube-state-metrics/
Apache License 2.0
5.21k stars 1.93k forks source link

Support metrics for Sidecar containers #2436

Closed Stono closed 2 days ago

Stono commented 2 days ago

What would you like to be added:

kube_pod_container_resource_requests should support Sidecar containers (those with restartPolicy: Always).

Why is this needed:

We've recently migrated a bunch of workloads from containers to initContainers, such as istio-proxy, cloudsql-proxy etc. We use to use kube_pod_container_resource_requests{container="istio-proxy"} to generate alerts when the cpu usage of that container > the request.

Describe the solution you'd like

As sidecar containers are really just like any other running container, it would be good for them to just be included in kube_pod_container_resource_requests regardless of if they're in containers or initContainers with restartPolicy: Always.

Additional context

k8s-ci-robot commented 2 days ago

This issue is currently awaiting triage.

If kube-state-metrics contributors determine this is a relevant issue, they will accept it by applying the triage/accepted label and provide further guidance.

The triage/accepted label can be added by org members by writing /triage accepted in a comment.

Instructions for interacting with me using PR comments are available [here](https://git.k8s.io/community/contributors/guide/pull-requests.md). If you have questions or suggestions related to my behavior, please file an issue against the [kubernetes-sigs/prow](https://github.com/kubernetes-sigs/prow/issues/new?title=Prow%20issue:) repository.
Stono commented 2 days ago

Ah, there is kube_pod_init_container_resource_requests. Shall close this off and think about how we migrate across.