Comments (8)
kube-state-metrics
intends to mirror what the Kubernetes API exposes. If there is a clear connection between objects I'm happy to expose that in a label in the kube_pod_info
metric. A candidate for that could be an ownerReference
, which if a Pod
belongs to a ReplicaSet
is set to that ReplicaSet
.
Alternatively if using Prometheus, you can use relabelling rules to parse these things out of the Pod
s name.
More generally regarding metric and label exposure these rules apply:
- https://github.com/kubernetes/community/blob/master/contributors/devel/instrumentation.md#normalization
- #27 (comment)
from kube-state-metrics.
So we have the ReplicaSet information in the kube_pod_info
metric, but as also mentioned in #27, one is usually not interested in the ReplicaSet directly, but the Deployment / DaemonSet / ... that created it. That is, the creator of the creator. Though including this two-level info could be seen as somewhat arbitrary (what if there is nothing above the ReplicaSet or a directly created pod, or what if even the Deployment was created by something higher up that you want to track?), it seems that 99% of pods are either directly rooted at something exactly 2 creation levels apart (Deployment, DaemonSet, ...) or started as standalone pods.
So I think it would be useful and not too problematic to include that information in the kube_pod_info
metric somehow. The names of those objects should also not change during a pod's lifetime, meaning there shouldn't be a concern about denormalization changing all pod series here.
The question would be what to name the labels for this. We already have created_by_kind
and created_by_name
labels for the first parent, but what would the labels be called for the grandparent?
from kube-state-metrics.
Generally I'm all for this if we can get this information presented in a reasonable way.
The created_by_*
labels are deprecated, as the underlying annotation on upstream objects is as well in favor of the OwnerReferences. The problem with that is that an object can have multiple owners, and then it's hard to create a label "owners owner", as that can be a list rather than a single value.
from kube-state-metrics.
Ah damn, wasn't aware of multiple owners. That makes the whole thing harder indeed. Do you think multiple owners will actually be common, or an exceptional thing?
from kube-state-metrics.
Already seeing that today already unfortunately, so we can't just make assumptions. While maybe not as simple as it should be, we can still solve this with a couple of recording rules in Prometheus with joins and group_left statements. I'm guessing that's what you were trying to avoid though 🙂 .
from kube-state-metrics.
Issues go stale after 90d of inactivity.
Mark the issue as fresh with /remove-lifecycle stale
.
Stale issues rot after an additional 30d of inactivity and eventually close.
If this issue is safe to close now please do so with /close
.
Send feedback to sig-testing, kubernetes/test-infra and/or fejta.
/lifecycle stale
from kube-state-metrics.
Stale issues rot after 30d of inactivity.
Mark the issue as fresh with /remove-lifecycle rotten
.
Rotten issues close after an additional 30d of inactivity.
If this issue is safe to close now please do so with /close
.
Send feedback to sig-testing, kubernetes/test-infra and/or fejta.
/lifecycle rotten
/remove-lifecycle stale
from kube-state-metrics.
Rotten issues close after 30d of inactivity.
Reopen the issue with /reopen
.
Mark the issue as fresh with /remove-lifecycle rotten
.
Send feedback to sig-testing, kubernetes/test-infra and/or fejta.
/close
from kube-state-metrics.
Related Issues (20)
- kube-state-metrics - write: broken pipe HOT 26
- Take field modifications into account in CRS configurations HOT 1
- Unable to opt in service account metrics with cli HOT 1
- I would like to calculate the duration for which certain pods are running HOT 1
- Kubernetes-Security-Slam-2023 HOT 8
- Add a workflow for release HOT 2
- SLSA Attestation to be generated with new releases. HOT 5
- Pod ready time HOT 4
- `kube_persistentvolume_*` and `kube_persistentvolumeclaim_*` should expose the volume name under the same label HOT 5
- Update kube-state-metrics helm chart to v2.0 HOT 2
- Timeline for a release of Kube State Metrics that uses v1.28 of the Kubernetes client-go package? HOT 3
- If a container doesn't have cpu limits, kube_pod_resource_limit reports the init-container limit HOT 4
- CustomResource: no metrics if CRD apply after ksm starts HOT 7
- kube_namespace_labels not exported after upgrading from 2.9.2 to 2.10.1 HOT 7
- Kube-state-metrics 20x spikes in memory usage at restart HOT 5
- Reconsider Stable Metrics Approach via CLI flag HOT 1
- Additional Labels not exported by KSM HOT 5
- kube-state-metrics v2.10.1 CVE's HOT 7
- Why do kube-state-metrics clusterrole need access to list,watch all secrets at cluster scope? HOT 5
- What is kube-state-metrics status on Kubernetes 1.29? HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from kube-state-metrics.