Skip to content
System types · Built-in All levels

kgateway

The built-in kgateway system type for the gateway proxy - why it is picked by hand, getting traces and metrics from a ListenerPolicy and the proxy's own endpoint, what Envoy's response flags say about a failure, and per-route checks that do not drag every integration down.

SLSluicio team 7 min read Updated Nov 2026

kgateway is a CNCF implementation of the Kubernetes Gateway API, built on Envoy. Each Gateway resource becomes a fleet of Envoy proxies that route your traffic, configured by kgateway’s control plane. This type watches the proxy: the service in the traffic path, which is what your integrations go through.

Key: kgateway · picked by hand on the gateway’s service. It does not apply automatically, for the reason below.

A kgateway installation is two kinds of process, and they emit telemetry that does not overlap:

ProcessEmitsType
gateway proxy (one Deployment per Gateway)Envoy traces, envoy_* metricskgateway (this page)
control plane (the kgateway Deployment)kgateway_* metricskgateway-controller

A check belongs where its metric exists, so each process has its own type. Apply each to its own service. The most important control plane check, a gateway that rejected its configuration and silently stopped taking route changes, lives on the other type.

The proxy is plain Envoy. Its metrics are Envoy’s, its spans are Envoy’s, and nothing in either names kgateway. Recognising it from envoy_ would offer “kgateway” to every Istio gateway, Envoy Gateway and Contour proxy as well. So on the gateway’s service, tick Mark as a system and pick kgateway as its type, once. Its checks are then offered like any other type’s.

Point the gateway at a Collector with a ListenerPolicy. kgateway names the proxy’s service <gateway>.<namespace> (for example http.kgateway-system) and adds service.version and the Kubernetes resource attributes on its own.

listenerpolicy.yaml
apiVersion: gateway.kgateway.dev/v1alpha1
kind: ListenerPolicy
metadata:
name: otel
namespace: kgateway-system
spec:
targetRefs:
- group: gateway.networking.k8s.io
kind: Gateway
name: http
default:
httpSettings:
tracing:
provider:
openTelemetry:
grpcService:
backendRef: { name: otel-collector, namespace: kgateway-system, port: 4317 }
# Optional: access logs over OTLP, correlated with the trace.
accessLog:
- openTelemetry:
grpcService:
backendRef: { name: otel-collector, namespace: kgateway-system, port: 4317 }
logName: http-gateway-access-log
body: '"%REQ(:METHOD)% %REQ(:PATH)% %PROTOCOL%" %RESPONSE_CODE% %RESPONSE_FLAGS% %UPSTREAM_CLUSTER%'

ListenerPolicy replaced HTTPListenerPolicy in kgateway 2.5.

The proxy does not push metrics. Its pods are annotated for scraping (/metrics on port 9091), and so is the control plane (port 9092). One scrape job covers both. The two job rules matter: the receiver turns job into service.name, and these give the proxy the same name its traces carry, so a gateway’s metrics and traces are one service in Sluicio. The control plane becomes kgateway.

otel-collector.yaml (receivers)
receivers:
prometheus/kgateway:
config:
scrape_configs:
- job_name: kgateway
scrape_interval: 30s
kubernetes_sd_configs: [{ role: pod }]
relabel_configs:
# kgateway's own pods: the controller and every gateway proxy.
- source_labels: [__meta_kubernetes_pod_label_kgateway]
regex: kgateway|kube-gateway
action: keep
- source_labels: [__meta_kubernetes_pod_annotation_prometheus_io_scrape]
regex: "true"
action: keep
- source_labels: [__address__, __meta_kubernetes_pod_annotation_prometheus_io_port]
regex: ([^:]+)(?::\d+)?;(\d+)
replacement: $$1:$$2
target_label: __address__
- source_labels: [__meta_kubernetes_pod_annotation_prometheus_io_path]
regex: (.+)
target_label: __metrics_path__
# service.name: "kgateway" for the controller,
# <gateway>.<namespace> for a proxy, matching its traces.
- source_labels: [__meta_kubernetes_pod_label_app_kubernetes_io_name]
target_label: job
- source_labels: [__meta_kubernetes_pod_label_gateway_networking_k8s_io_gateway_name, __meta_kubernetes_namespace]
regex: (.+);(.+)
replacement: $$1.$$2
target_label: job

$$ is how a literal $ is written in a Collector configuration. Pod discovery needs a ClusterRole that can get, list and watch pods for the Collector’s service account.

Envoy marks a span failed when the response is a 5xx and leaves a 4xx alone, so no “Treat HTTP 5xx as errors” setting is needed. Each span also carries response_flags, which says whether the gateway itself was the reason. What kgateway 2.5 produced for each kind of fault:

What happenedResponseresponse_flagsSpan failed
The backend answered 503503-yes
The route’s backend does not exist500NCyes
The backend Service has no ready pods503UHyes
The backend refused the connection503UFyes
The route’s timeout ran out504UTyes
No route matches the host or path404NRno

Each span also names the URL (http.url) and, when a backend was chosen, upstream_cluster, which kgateway names kube_<namespace>_<service>_<port>.

CheckConditionSeverityScope
Requests failing≥ 1 failed span in 5 minutesWarningper route
Route points at a missing backend≥ 1 failed span with response_flags NC in 5 minutesWarningper route
No healthy backendenvoy_cluster_upstream_cx_none_healthy rising, split by envoy_cluster_nameWarningper route
Backend refusing connectionsenvoy_cluster_upstream_cx_connect_fail rising, split by envoy_cluster_nameWarningper route
Backend timeoutsenvoy_cluster_upstream_rq_timeout rising, split by envoy_cluster_nameWarningper route
Slow requestsp95 ≥ 2000 ms over 5 minutesWarningper route
Gateway silentno requests in 15 minutesWarningwhole gateway
Proxy lost the control planeenvoy_control_plane_connected_state < 1Warningwhole gateway
Gateway proxy not runningenvoy_server_live stops arrivingCriticalwhole gateway

A missing backend is only visible in the trace. kgateway accepts a route whose backendRef names a Service that does not exist (its status says ResolvedRefs: False), and the gateway answers 500 without contacting anything. No Envoy cluster is involved, so none of the backend counters move.

Losing the control plane does not stop traffic. The proxy keeps serving its last configuration, which is why nothing else would notice. What stops is change: a new route or policy does not arrive until the proxy reconnects.

A gateway is shared: it routes for every integration behind it. The per-route checks above are declared as describing one flow, so a failing backend does not mark every integration on the gateway unhealthy. The whole-gateway checks are left unsplit on purpose, so they do reach every integration: a proxy that is down breaks all of them.

To alert on one route alone, make it an integration: match the gateway’s service and a condition on http.url (or upstream_cluster), and bind checks to that.

  • Backend counters appear when first used. The proxy’s /metrics is Envoy’s “used only” view, so envoy_cluster_upstream_rq_timeout does not exist until a timeout happens. A check reads the rise within its window, so a backend’s very first failures since the proxy started are counted from the next scrape on. Scraping /stats/prometheus on the admin port instead lists every counter from zero, at about four times the series.
  • Sampling thins the trace checks, not the metrics. With randomSampling below 100 in the ListenerPolicy, the span-based checks see a sample. Lower their thresholds accordingly, or rely on the backend counters, which count every request.
  • No check on unmatched requests. A 404 with NR is what a scanner probing random hosts produces all day on a public gateway, so it is not an alert by default. On an internal gateway it can mean a route that never took effect; see Gateway rejected its configuration.
  • Slow requests depends on what is behind the gateway. 2000 ms is a stuck UI call and a quick report export.