Skip to content

Commit 7de70ac

Browse files
committed
feat(monitoring-agents): export PVC labels from kube-state-metrics
The tenant metrics API scopes a query to one application by looking up its pods and PVCs through their apps.cozystack.io/application.* lineage labels. kube-state-metrics emits kube_persistentvolumeclaim_labels only for resources on --metric-labels-allowlist, so without PVCs there the PVC half of that lookup always comes back empty and volume series of an application fall out of its scope. All labels are allowed, as for pods and deployments: kube-state-metrics emits one series per PVC whatever keys are listed, and PVCs are far fewer than pods, which already export every label. Assisted-by: LLM Signed-off-by: ZverGuy <[email protected]>
1 parent 4087218 commit 7de70ac

2 files changed

Lines changed: 25 additions & 4 deletions

File tree

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
suite: kube-state-metrics exports the labels of pods, deployments and PVCs
2+
# The tenant metrics API scopes a query to one application by looking up the
3+
# application's pods and PVCs in kube_pod_labels and
4+
# kube_persistentvolumeclaim_labels by their apps.cozystack.io/application.*
5+
# lineage labels. kube-state-metrics emits no kube_*_labels series at all for
6+
# a resource missing from this allowlist, so dropping persistentvolumeclaims
7+
# silently empties the PVC branch of that lookup.
8+
templates:
9+
- charts/kube-state-metrics/templates/deployment.yaml
10+
tests:
11+
- it: allowlists all labels of pods, deployments and persistentvolumeclaims
12+
asserts:
13+
- contains:
14+
path: spec.template.spec.containers[0].args
15+
content: --metric-labels-allowlist=pods=[*],deployments=[*],persistentvolumeclaims=[*]

‎packages/system/monitoring-agents/values.yaml‎

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,10 @@ kube-state-metrics:
66
# 322 pods and roughly 25.6k series, which is the smallest cluster we run. The
77
# request sits above the 176Mi mean rather than at the peak, and the limit
88
# carries wide headroom on purpose: this component's memory scales with the
9-
# number of objects in the cluster, and --metric-labels-allowlist below widens
10-
# every pod and deployment series further, so a cluster larger than the one
11-
# measured will land well above the peak seen here.
9+
# number of objects in the cluster, and --metric-labels-allowlist below copies
10+
# every label of each pod, deployment and PVC onto its kube_*_labels series,
11+
# so a cluster larger than the one measured will land well above the peak
12+
# seen here.
1213
# 2Gi is 6.7x that peak, so scaling linearly with object count it stays a
1314
# ceiling rather than a bound up to roughly 2100 pods and 170k series.
1415
#
@@ -27,7 +28,12 @@ kube-state-metrics:
2728
limits:
2829
memory: 2Gi
2930
extraArgs:
30-
- --metric-labels-allowlist=pods=[*],deployments=[*]
31+
# PVCs are listed so the tenant metrics API can find an application's PVCs
32+
# in kube_persistentvolumeclaim_labels by their apps.cozystack.io/application.*
33+
# lineage labels. kube-state-metrics emits that metric only for resources on
34+
# this list, one series per PVC; naming only the lineage keys would emit the
35+
# same number of series.
36+
- --metric-labels-allowlist=pods=[*],deployments=[*],persistentvolumeclaims=[*]
3137
rbac:
3238
extraRules:
3339
- apiGroups:

0 commit comments

Comments
 (0)