-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Open
Labels
triage/acceptedIndicates an issue or PR is ready to be actively worked on.Indicates an issue or PR is ready to be actively worked on.
Description
Description
When using kube-state-metrics v2.16.0 (and later) on Kubernetes 1.30, resource request metrics for Sidecar containers (e.g., kube_pod_container_resource_requests_cpu_cores) are missing.
However, on Kubernetes 1.28 with the same kube-state-metrics version, Sidecar container metrics are collected correctly.
Steps to Reproduce
- Deploy a Kubernetes 1.30 cluster
- Deploy kube-state-metrics v2.16.0
- Deploy Pods containing Sidecar containers with explicitly declared resource requests
- Query Prometheus metrics and notice the missing Sidecar container resource request metrics
Root Cause Analysis
- Kubernetes 1.30 introduces GA for Sidecar lifecycle, separating Sidecar containers from Pod.Spec.Containers, changing the API structure.
- kube-state-metrics still only iterates over Pod.Spec.Containers when collecting metrics, not considering the new Sidecar container fields or Pod.Status.ContainerStatuses.
- This results in missing resource request metrics for Sidecar containers.
Expected Behavior
kube-state-metrics should support Kubernetes 1.30 and later versions by correctly collecting resource requests and limits for all containers, including Sidecar containers.
Suggested Solution
- Update the collection logic to iterate over all running containers (e.g., Pod.Status.ContainerStatuses) instead of just Pod.Spec.Containers
- Or add support for the new Sidecar container fields introduced in Kubernetes 1.30
Environment
- kube-state-metrics version: v2.16.0
- Kubernetes version: v1.30
- Deployment method: Helm Chart / other
kuzaxak, gpassini and riccardo32
Metadata
Metadata
Assignees
Labels
triage/acceptedIndicates an issue or PR is ready to be actively worked on.Indicates an issue or PR is ready to be actively worked on.
Type
Projects
Status
In Progress