Skip to main content

Availability

The Edge Gateway works with the Kubernetes Inference Gateway in both editions.

Overview

The Gateway API Inference Extension routes inference requests to self-hosted model servers, such as vLLM, SGLang, or TGI. Put the Tyk AI Studio Edge Gateway in front of it. The Edge Gateway adds App authentication, LLM access, budgets, filters, and token and cost analytics. The Endpoint Picker of the extension selects a model server pod of an InferencePool for each request. The InferencePool serves an OpenAI-compatible API, so you add it to AI Studio as an LLM provider with the OpenAI vendor.

What AI Studio Does Not Do

The Edge Gateway is not a Gateway API Inference Extension implementation. It does not watch InferencePool resources, implement the Endpoint Picker protocol, or select model server pods. For pod selection, put the Edge Gateway in front of a Kubernetes Gateway API implementation that supports the Inference Extension.

Before You Start

  • Tyk AI Studio installed with Helm. Refer to Install Tyk AI Studio on Kubernetes.
  • A Kubernetes Gateway API implementation with Inference Extension support, and an InferencePool that serves your models.
  • The Prometheus Operator, if you turn on the ServiceMonitor. Without its CRDs, the install fails.
  • An OpenTelemetry collector, if you turn on tracing.

Deploy the Edge Gateway

The AI Studio repository includes reference values for this setup: helm/my-values-inference-gateway.yaml. The file does these things:
  • Runs two Edge Gateway replicas with a PodDisruptionBudget and a spread across zones.
  • Puts the Edge Gateways in the edge namespace inference.
  • Blocks upstreams on internal addresses, except in-cluster Services. Refer to Allow the Edge Gateway to Reach the InferencePool.
  • Exposes metrics for Prometheus and sends traces to an OTLP collector.
  • Uses a StatefulSet with a volume, so that buffered analytics survive a restart.
  • Reads the Edge Gateway secrets from a Secret that you manage.
The file sets only the values for this setup. Use it with the values file of your AI Studio installation. Helm applies the files in order:
Before you install, check these values: The AI Studio Service name is the release name if it contains midsommar, else <release>-midsommar. For example, the release ai-studio gives ai-studio-midsommar:50051. For all chart values, refer to the values file of the chart. Each Edge Gateway pod registers with AI Studio under its pod name. To check the Edge Gateways, go to Portal administration > Edge Gateways. Edge Gateways page with a connected Edge Gateway, its namespace, and its sync status

Allow the Edge Gateway to Reach the InferencePool

From v2.3.0, the Edge Gateway blocks internal addresses by default (LLM_UPSTREAM_BLOCK_INTERNAL). This also blocks the cluster address of the InferencePool. To keep the block and allow the cluster, set both values:
LLM_UPSTREAM_ALLOWED_INTERNAL_HOSTS is a comma-separated list of hosts:
  • An entry that starts with a dot matches the domain and its subdomains. For example, .svc.cluster.local matches vllm.inference.svc.cluster.local. It does not match evilsvc.cluster.local.
  • Other entries must match the host exactly. The match is not case-sensitive.
  • A host in this list is permitted, even when LLM_UPSTREAM_ALLOWED_HOSTS is set. The gateway checks this list first.
  • The gateway applies the list when it checks the upstream URL and again when it connects.
Do not use LLM_UPSTREAM_ALLOWED_HOSTS for in-cluster hosts. When it is set, the gateway refuses every upstream host that is not in the list, including the hosted vendors. For the related setting, refer to ALLOW_INTERNAL_NETWORK_ACCESS.

Create the LLM Provider

In AI Studio, create an LLM provider for the InferencePool. Refer to Create an LLM Provider.
The Endpoint Picker selects a pod only for requests that pass through a Kubernetes Gateway route to the InferencePool. If the API endpoint is the Service of the model server pods, the requests do not go through the Endpoint Picker.
Edit LLM provider form with the OpenAI vendor, an in-cluster API endpoint, and the Restricted privacy level All other settings work as for a hosted vendor: privacy levels, budgets, filters, failover, and App access. An Edge Gateway in the namespace inference receives the LLMs and Apps in that namespace and the global ones (no namespace). Make sure that the Apps that call the InferencePool are global or in the same namespace. Edge Availability section of the LLM provider form with the inference namespace selected After you save, push the configuration to the Edge Gateways. Refer to Push Configuration to Edge Gateways.

Route Traffic to the Edge Gateway

Add the Edge Gateway Service as a backend of an HTTPRoute. With the release name midsommar, the Service is midsommar-microgateway on port 8080:
The same Kubernetes Gateway can also have the route to the InferencePool. Then use a different hostname or listener for each route. The two routes then do not match the same requests. Clients authenticate with an App credential and call the Edge Gateway:
  • The Main Ingress, /v1/chat/completions, with the model string {llmSlug}/{model}.
  • The OpenAI-compatible endpoint, /ai/{llmSlug}/v1/chat/completions.
Refer to Endpoints.

Metrics and Traces

The reference values turn on metrics and tracing for the Edge Gateways: The Edge Gateway continues the trace of an incoming traceparent header, and sends it to the upstream. Thus, one trace can show the request from the Kubernetes Gateway, through the Edge Gateway, to the model server.