kube-state-metrics icon indicating copy to clipboard operation
kube-state-metrics copied to clipboard

Gather `ownerReferences` for all object types

Open bartebor opened this issue 2 years ago • 6 comments

What would you like to be added: As far as I see a metrics like kube_pod_owner is created for very few object types: pods, replicasets and jobs. There are more object types being owned by some other objects or controllers. We are also using a custom CRDs which own deployments and HPAs.

Why is this needed: Having owner references of all kubernetes objects would allow connecting objects together in grafana dashboards. As for now this is limited to selected objects only.

Describe the solution you'd like I would like to have owner references for all object types, including custom CRDs. This could be opt-in feature - some command line flag, maybe something similar to --resources for default object types and some field in custom resource configuration for CRDs. This way it would not break backward compatibility nor introduce new metrics for those space concerned.

bartebor avatar Feb 14 '23 15:02 bartebor

/triage accepted /assign @dgrisonnet @rexagod

logicalhan avatar Feb 23 '23 17:02 logicalhan

This would help us a great deal 👍

gabeduke avatar Jun 13 '23 20:06 gabeduke

I drafted a possible solution and would like feedback before moving forward with it. I've deployed and tested with this image. @dgrisonnet @rexagod is this already being worked on? Happy to continue working on this with your guidance.

» curl -s localhost:8080/metrics | grep kube_pod_container_status_restarts_total | grep kube-state
kube_pod_container_status_restarts_total{created_by_kind="ReplicaSet",created_by_name="prom-stack-kube-state-metrics-6f9949d79f",namespace="monitoring",pod="prom-stack-kube-state-metrics-6f9949d79f-2dcm8",uid="6f7a498f-a125-4695-8670-d57ff553fa9e",container="kube-state-metrics"} 0

gabeduke avatar Jun 15 '23 03:06 gabeduke

This issue has not been updated in over 1 year, and should be re-triaged.

You can:

  • Confirm that this issue is still relevant with /triage accepted (org members only)
  • Close this issue with /close

For more details on the triage process, see https://www.kubernetes.dev/docs/guide/issue-triage/

/remove-triage accepted

k8s-triage-robot avatar Jun 14 '24 03:06 k8s-triage-robot