kube-state-metrics
kube-state-metrics copied to clipboard
Duplicated custom resource metrics when exposed for builtin type
What happened:
Wanted to expose additional information for storageclass, expanded the config
kind: CustomResourceStateMetrics
spec:
resources:
- groupVersionKind:
group: storage.k8s.io
kind: StorageClass
version: v1
metricNamePrefix: kube_storageclass
metrics:
- name: "parameters"
help: "StorageClass parameters"
each:
type: Info
info:
labelsFromPath:
skuName: [parameters, skuName]
storageclass: [metadata, name]
I noticed that they are exposed twice, which makes it impossible to be scraped by prometheus (metrics are duplicated)
# HELP kube_storageclass_parameters StorageClass parameters
# TYPE kube_storageclass_parameters info
kube_storageclass_parameters{customresource_group="storage.k8s.io",customresource_kind="StorageClass",customresource_version="v1",storageclass="standard"} 1
# HELP kube_storageclass_parameters StorageClass parameters
# TYPE kube_storageclass_parameters info
kube_storageclass_parameters{customresource_group="storage.k8s.io",customresource_kind="StorageClass",customresource_version="v1",storageclass="standard"} 1
What you expected to happen:
Metrics are exposed once
How to reproduce it (as minimally and precisely as possible):
Use the config provided with k-s-m and kind cluster
Anything else we need to know?: Full logs
I0412 11:54:47.701990 1 wrapper.go:98] "Starting kube-state-metrics"
I0412 11:54:47.702368 1 builder.go:192] "The internal resource store already exists and is overridden by a custom resource store with the same name, please make sure it meets your expectation" registryName="storageclasses"
I0412 11:54:47.702518 1 server.go:186] "Used default resources"
I0412 11:54:47.702577 1 types.go:184] "Using all namespaces"
I0412 11:54:47.702660 1 server.go:219] "Metric allow-denylisting" allowDenyStatus="Including the following lists that were on allowlist: kube_deployment_labels, kube_pod_labels, kube_storageclass_labels, kube_storageclass_parameters"
W0412 11:54:47.702744 1 client_config.go:618] Neither --kubeconfig nor --master was specified. Using the inClusterConfig. This might not work.
I0412 11:54:47.703382 1 server.go:364] "Tested communication with server"
I0412 11:54:47.710477 1 server.go:369] "Run with Kubernetes cluster version" major="1" minor="26" gitVersion="v1.26.3" gitTreeState="clean" gitCommit="9e644106593f3f4aa98f8a84b23db5fa378900bd" platform="linux/amd64"
I0412 11:54:47.710870 1 server.go:370] "Communication with server successful"
I0412 11:54:47.711399 1 server.go:316] "Started metrics server" metricsServerAddress="[::]:8080"
I0412 11:54:47.711684 1 server.go:74] levelinfomsgListening onaddress[::]:8080
I0412 11:54:47.711779 1 server.go:74] levelinfomsgTLS is disabled.http2falseaddress[::]:8080
I0412 11:54:47.711911 1 metrics_handler.go:99] "Autosharding disabled"
I0412 11:54:47.713339 1 server.go:305] "Started kube-state-metrics self metrics server" telemetryAddress="[::]:8081"
I0412 11:54:47.713536 1 server.go:74] levelinfomsgListening onaddress[::]:8081
I0412 11:54:47.713564 1 server.go:74] levelinfomsgTLS is disabled.http2falseaddress[::]:8081
I0412 11:54:47.714317 1 custom_resource_metrics.go:79] "Custom resource state added metrics" familyNames=[kube_storageclass_parameters]
I0412 11:54:47.714778 1 custom_resource_metrics.go:79] "Custom resource state added metrics" familyNames=[kube_storageclass_parameters]
Environment:
- kube-state-metrics version:
2.8.0
- Kubernetes version (use
kubectl version
): 1.25 and 1.26 - Cloud provider or hardware configuration: AKS and local - kind
- Other info: