Skip to content

Commit

Permalink
Merge pull request #66 from grafana/fix/kube-state-metrics-by-endpoint
Browse files Browse the repository at this point in the history
Change ksm to discover by endpoints
  • Loading branch information
petewall authored Jan 8, 2025
2 parents 9b3f4ed + 374d3a2 commit 32aeea4
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions modules/kubernetes/kube-state-metrics/metrics.alloy
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,12 @@ declare "kubernetes" {
optional = true
}

// kube state metrics service discovery for all of the pods
// kube state metrics service discovery for all of the endpoints
discovery.kubernetes "ksm" {
role = "service"
role = "endpoints"

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

// only keep targets with a matching port name
rule {
source_labels = ["__meta_kubernetes_service_port_name"]
source_labels = ["__meta_kubernetes_endpoint_port_name"]
regex = coalesce(argument.port_name.value, "http")
action = "keep"
}
Expand Down

0 comments on commit 32aeea4

Please sign in to comment.