Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 32aeea4

Browse files
authoredJan 8, 2025
Merge pull request #66 from grafana/fix/kube-state-metrics-by-endpoint
Change ksm to discover by endpoints
2 parents 9b3f4ed + 374d3a2 commit 32aeea4

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed
 

‎modules/kubernetes/kube-state-metrics/metrics.alloy

+4-4
Original file line numberDiff line numberDiff line change
@@ -33,12 +33,12 @@ declare "kubernetes" {
3333
optional = true
3434
}
3535

36-
// kube state metrics service discovery for all of the pods
36+
// kube state metrics service discovery for all of the endpoints
3737
discovery.kubernetes "ksm" {
38-
role = "service"
38+
role = "endpoints"
3939

4040
selectors {
41-
role = "service"
41+
role = "endpoints"
4242
field = string.join(coalesce(argument.field_selectors.value, []), ",")
4343
label = string.join(coalesce(argument.label_selectors.value, ["app.kubernetes.io/name=kube-state-metrics"]), ",")
4444
}
@@ -54,7 +54,7 @@ declare "kubernetes" {
5454

5555
// only keep targets with a matching port name
5656
rule {
57-
source_labels = ["__meta_kubernetes_service_port_name"]
57+
source_labels = ["__meta_kubernetes_endpoint_port_name"]
5858
regex = coalesce(argument.port_name.value, "http")
5959
action = "keep"
6060
}

0 commit comments

Comments
 (0)
Please sign in to comment.