Routing
The XTrinode gateway is the load balancer and reverse proxy for Trino client
traffic. It receives queries from users, BI tools, notebooks, and applications,
then selects the right backend coordinator. It sits behind an ingress,
LoadBalancer Service, or internal Service; it is not itself an Ingress
controller.
Route Inputs
Section titled “Route Inputs”Routes can be selected by:
- hostname;
X-Trino-XTrinodeheader;- default route;
- shared routing groups when multiple runtime backends should load-balance.
Routing priority is:
- Hostname.
X-Trino-XTrinodeheader.- Default route.
A provided header that does not match a route should return an explicit failure rather than silently falling back to the default route.
Route definitions are stored in the trino-gateway-routes ConfigMap in the
gateway namespace. The gateway keeps the last-good route set when a full config
load is invalid.
Query Path
Section titled “Query Path”Client -> optional ingress -> XTrinode gateway -> selected coordinator service -> Trino coordinator -> Trino workersDedicated Runtime
Section titled “Dedicated Runtime”Each runtime can get its own routing group and generated hostname.
apiVersion: analytics.xtrinode.io/v1kind: XTrinodemetadata: name: runtime-a namespace: productionspec: size: m routing: header: X-Trino-XTrinode=production/runtime-a hostnameDomain: trino.example.comResult:
- routing group:
production--runtime-a; - header selector:
production/runtime-a; - hostname:
production--runtime-a.trino.example.com; - backend: the
runtime-acoordinator.
Shared Pool
Section titled “Shared Pool”Multiple runtimes can join the same routing group for load balancing.
apiVersion: analytics.xtrinode.io/v1kind: XTrinodemetadata: name: runtime-shared-1 namespace: productionspec: size: m routing: routingGroup: shared hostnameDomain: trino.example.com---apiVersion: analytics.xtrinode.io/v1kind: XTrinodemetadata: name: runtime-shared-2 namespace: productionspec: size: m routing: routingGroup: shared hostnameDomain: trino.example.comResult:
- routing group:
shared; - hostname:
shared.trino.example.com; - backends:
runtime-shared-1andruntime-shared-2.
Explicit Hostname
Section titled “Explicit Hostname”Use routing.hostname when the public hostname should not be generated from the
routing group.
apiVersion: analytics.xtrinode.io/v1kind: XTrinodemetadata: name: analytics namespace: productionspec: size: l routing: hostname: analytics.example.comDefault Route
Section titled “Default Route”Mark one route as the fallback for requests without an explicit selector.
apiVersion: analytics.xtrinode.io/v1kind: XTrinodemetadata: name: default-runtime namespace: productionspec: size: s routing: default: trueUse default routes sparingly. They are convenient for early testing, but hostname routing is usually clearer for production-facing entrypoints.
Suspended Runtimes
Section titled “Suspended Runtimes”When a selected route points at a suspended runtime, or when a coordinator is temporarily unreachable, the gateway can ask the API server to resume it. The client then retries after resume has started.
The API server uses a Kubernetes lease for each runtime or routing group so only one resume operation wins when many clients arrive at the same time.
Operational Checks
Section titled “Operational Checks”When routing fails, check:
- gateway logs;
- gateway route ConfigMap;
- runtime phase and status conditions;
- coordinator service DNS;
- the expected hostname or
X-Trino-XTrinodeheader; - API server resume responses;
- KEDA status when worker scaling is enabled.