It would be great if KSM had an optional set of metrics which would describe relations between resources.
For example:
Which HPA is controlling which deployment/statefulset.
Which service is connected to which pod.
Which ingress is connected to which service.
Possibly many more relations can be figured out ...
Why is this needed:
This would give a possibility to query relation changes over time. Also it would allow to create smarter and more detailed alerts about changes to configuration.
Describe the solution you'd like
If the label combinations are not frequently changing it should not have a big impact on memory usage for Prometheus or any other tool that is going to scrape and persist those metrics.
kube_ingress_relation{ingress="name-of-the-ingress", service="name-of-the-service", namespace="name-of-the-namespace"} 1 kube_service_relation{service="name-of-the-service", pod="name-of-the-pod", namespace="name-of-the-namespace"} 1 kube_hpa_relation{hpa="name-of-the-hpa", deployment="name-of-the-deployment", namespace="name-of-the-namespace"} 1
Possibly using resource uids might give better insight while being less fragile.
Additional context
This idea came from trying to develop Grafana Scenes App for Kubernetes to display cluster state based on collected metrics. If we would have metrics describing relations we could easily query state & alerts for related sources and build a full picture about the current state at any given time.
What would you like to be added:
It would be great if KSM had an optional set of metrics which would describe relations between resources.
For example:
Why is this needed:
This would give a possibility to query relation changes over time. Also it would allow to create smarter and more detailed alerts about changes to configuration.
Describe the solution you'd like
If the label combinations are not frequently changing it should not have a big impact on memory usage for Prometheus or any other tool that is going to scrape and persist those metrics.
kube_ingress_relation{ingress="name-of-the-ingress", service="name-of-the-service", namespace="name-of-the-namespace"} 1 kube_service_relation{service="name-of-the-service", pod="name-of-the-pod", namespace="name-of-the-namespace"} 1 kube_hpa_relation{hpa="name-of-the-hpa", deployment="name-of-the-deployment", namespace="name-of-the-namespace"} 1
Possibly using resource uids might give better insight while being less fragile.Additional context
This idea came from trying to develop Grafana Scenes App for Kubernetes to display cluster state based on collected metrics. If we would have metrics describing relations we could easily query state & alerts for related sources and build a full picture about the current state at any given time.