Scrape the Kong gateways

Every dataplane pod the Kong operator creates declares a container port named
`metrics` (8100) and carries the gateway-name label, so discovery keys off
those rather than an annotation — the operator owns that pod template, not us,
and adding annotations there would mean editing the shared dataplane template
and restarting every gateway.

Keeping on the port NAME rather than a number also drops the init containers,
which declare no port at all.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
Stéphane Tailland
2026-08-25 07:48:11 +02:00
parent 3937b4f366
commit 940abdf6fc
+32
View File
@@ -175,3 +175,35 @@ scrape_configs:
target_label: container target_label: container
- target_label: service - target_label: service
replacement: librechat replacement: librechat
# --- Kong gateways ------------------------------------------------------
# Every dataplane pod the Kong operator creates declares a container port
# named `metrics` (8100) and carries the gateway-name label, so no
# annotation is needed on the pods themselves — which matters because the
# operator owns that pod template, not us. Keeping on the port NAME rather
# than a number also drops the init containers, which declare no port.
#
# The RED series (kong_http_requests_total, kong_*_latency_ms,
# kong_bandwidth_bytes) only appear once the gateway has the `prometheus`
# KongPlugin bound; without it the endpoint still answers, but with node
# and shared-dict metrics only.
- job_name: kong-gateways
kubernetes_sd_configs:
- role: pod
relabel_configs:
- source_labels: [__meta_kubernetes_pod_label_gateway_networking_k8s_io_gateway_name]
action: keep
regex: .+
- source_labels: [__meta_kubernetes_pod_container_port_name]
action: keep
regex: metrics
- source_labels: [__meta_kubernetes_pod_label_gateway_networking_k8s_io_gateway_name]
target_label: gateway
- source_labels: [__meta_kubernetes_namespace]
target_label: namespace
- source_labels: [__meta_kubernetes_pod_name]
target_label: pod
- source_labels: [__meta_kubernetes_pod_container_name]
target_label: container
- source_labels: [__meta_kubernetes_pod_node_name]
target_label: node