Kubernetes Ingress for AI Gateways: Best Practices
Kubernetes Ingress exposes HTTP and HTTPS routes from outside a cluster to Services inside it. This guide covers the ingress definition, Ingress vs Gateway API after the ingress-nginx retirement, and how to configure streaming, timeouts, and rate limits for a self-hosted AI gateway.
TL;DR
- Kubernetes Ingress is a stable, frozen API that routes external HTTP and HTTPS traffic to Services; the Kubernetes project now recommends the Gateway API for new work.
- Ingress NGINX was retired after best-effort maintenance ended in March 2026, so clusters still running it receive no further releases or security fixes.
- AI gateway traffic needs non-REST ingress settings: buffering off, read timeouts sized to the longest stream, and a body limit that matches the gateway.
- Rate limiting belongs in two places: per-IP limits at the ingress protect the cluster, while request and token limits per virtual key at the AI gateway govern model spend.
- Bifrost runs inside the cluster as a Helm-deployed Service on port 8080 behind any compatible Ingress or Gateway API implementation, and applications switch to it by changing one base URL.
Kubernetes Ingress is the API object that exposes HTTP and HTTPS routes from outside a cluster to Services inside it, and it is the first hop that most AI gateway traffic crosses in a Kubernetes deployment. Defaults built for short REST calls (response buffering, short read timeouts, small body limits) cut off streamed LLM responses and reject large multimodal requests. Bifrost, the open-source AI gateway written in Go and built by Maxim AI, runs inside the cluster behind that ingress layer. This guide covers what Ingress does, where the Gateway API replaces it, and how to configure either for an AI gateway.
Ingress Definition: What Is Ingress in Kubernetes?
In general English, ingress means the act of entering, and in networking it describes traffic entering a system; egress is traffic leaving it. In Kubernetes, Ingress is a stable API object, available since v1.19, that maps external HTTP and HTTPS requests to cluster Services using hostnames, paths, and TLS rules, and an ingress controller implements those rules.
The Kubernetes Ingress documentation lists what an Ingress can provide: externally reachable URLs, load balancing, TLS termination, and name-based virtual hosting. An Ingress resource on its own does nothing until a running ingress controller reads it, and it covers only HTTP and HTTPS.
The ingress decides which Service receives a request for llm.example.com. Bifrost, sitting behind it as an AI gateway, decides which model, provider, and key serve that request, and whether the caller may make it.

Layered stack with external clients on top, a Kubernetes Ingress or Gateway API edge below them, the Bifrost Service in the cluster, and model providers at the bottom
Figure 1: The ingress layer owns TLS and HTTP routing into the cluster; model routing and AI policy start one layer down.
| Layer | Owns | Does not own |
|---|---|---|
| Kubernetes Ingress or Gateway API | TLS termination, hostnames, paths, edge rate limits, connection timeouts | Model selection, provider keys, token budgets |
| AI gateway (Bifrost) | Provider routing, failover, virtual keys, request and token limits, AI request logs | Public TLS certificates, cluster entry points |
| Model providers | Inference | Cross-provider policy |
Kubernetes Ingress vs Gateway API
The Kubernetes project recommends the Gateway API over Ingress for new deployments. Ingress remains generally available and will not be removed, but its API is frozen: it receives no further changes. The Gateway API is an add-on set of role-oriented resources that expresses timeouts, header matching, and traffic splitting in the spec instead of in controller-specific annotations.
The Gateway API documentation on kubernetes.io describes four stable kinds: GatewayClass, Gateway, HTTPRoute, and GRPCRoute. A platform team owns the Gateway (listeners, TLS certificates), and an application team attaches an HTTPRoute that points at its Service. Ingress folds both roles into one object and pushes everything else into controller-specific annotations.
| Question | Kubernetes Ingress | Gateway API |
|---|---|---|
| API status | Stable, frozen, no new features | Stable core kinds, still evolving |
| Role model | One resource for operators and app teams | Gateway for operators, HTTPRoute for app teams |
| Request timeouts | Controller annotations | timeouts.request field on HTTPRouteRule |
| Protocols | HTTP and HTTPS | HTTP and gRPC in the stable kinds; TCP, TLS, and UDP route kinds outside the stable set |
| Portability | Annotations rarely portable between controllers | Core fields portable across conformant implementations |
Either way, the edge proxy does not count tokens or route between providers; the differences between an AI gateway and an API gateway follow the same line.
The Ingress NGINX Retirement and What It Changes
Kubernetes SIG Network and the Security Response Committee announced in November 2025 that Ingress NGINX would be retired, with best-effort maintenance ending in March 2026 and no releases, bug fixes, or security patches after that. Existing installations keep running, but carry unpatched risk.
The Ingress NGINX retirement announcement recommends migrating to the Gateway API or another Ingress controller, and gives this check for clusters still running it:
kubectl get pods --all-namespaces \
--selector app.kubernetes.io/name=ingress-nginx
For an AI gateway, streaming, timeout, and body-size requirements stay the same whichever controller sits at the edge; only where they are configured changes. The Bifrost gateway works behind any compatible Gateway API implementation, ingress controller, LoadBalancer Service, or external proxy, as the Bifrost deployment overview lays out per platform.
Why AI Gateway Traffic Needs Different Ingress Settings
LLM traffic differs from REST traffic in three ways: responses stream for tens of seconds or minutes, request bodies carry images, audio, and long documents, and some APIs hold WebSocket connections open. Ingress defaults tuned for sub-second JSON calls buffer streams, close slow connections, and reject large bodies.
A streamed chat completion sends server-sent events (SSE) as the model produces tokens. A buffering proxy holds every chunk until generation ends, and a read timeout shorter than the longest generation closes the connection mid-answer. The Bifrost runtime requirements list exactly these conditions for any HTTP frontend placed in front of the gateway.

A streaming request flows from client through the ingress proxy to Bifrost and the provider, with buffering and read-timeout failure branches at the ingress
Figure 2: Both failures happen at the ingress proxy, before Bifrost or the provider has done anything wrong.
MCP tool traffic over SSE or Streamable HTTP holds connections open the same way, so one edge configuration should cover model and tool calls that share an LLM gateway endpoint.
Kubernetes Ingress Best Practices for Streaming LLM Traffic
Seven settings decide whether an ingress carries AI gateway traffic correctly: buffering, read and send timeouts, body size, TLS and forwarded headers, WebSocket upgrades, health checks, and connection draining. Each maps to a requirement the Bifrost AI gateway places on its HTTP frontend, and each is set differently per controller.
| Setting | AI gateway requirement | Typical starting value |
|---|---|---|
| Response buffering | Off, so SSE chunks are forwarded as they arrive | Disabled for the gateway host |
| Read and send timeouts | Longer than the slowest expected stream | 300 seconds, raised for long reasoning or batch calls |
| Request body size | At least the gateway's own limit | 100 MB, matching Bifrost's default max_request_body_size_mb |
| TLS and headers | Terminate TLS at the edge; preserve Host, X-Forwarded-For, X-Forwarded-Proto |
TLS certificate from a Secret |
| WebSocket upgrades | Allowed when Realtime or WebSocket APIs are used | Upgrade and Connection headers passed through |
| Health checks | Route only to pods that pass GET /health |
Readiness probe on port 8080 |
| Draining | Let in-flight streams finish before a pod exits | Grace period longer than the longest stream |
The NGINX reverse proxy guide for Bifrost uses 300-second timeouts with buffering off as a baseline; long reasoning or batch calls may need more. Bifrost serves plain HTTP inside the container, so TLS ends at the edge, and preserving the forwarded-protocol header keeps URLs Bifrost derives from the request, such as MCP OAuth callbacks, on the right scheme. For draining during scale-down, the Bifrost Helm best practices and common pitfalls cover the preStop delay and stabilization window.
Example Kubernetes Ingress YAML and HTTPRoute for an AI Gateway
The two manifests below expose Bifrost on port 8080 at llm.example.com with TLS. The first uses the networking.k8s.io/v1 Ingress API with controller-specific annotations; the second uses the Gateway API, where the request timeout is a spec field. Both assume the official Bifrost Helm chart was installed as release bifrost, which creates a ClusterIP Service named bifrost.
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: bifrost
namespace: ai-gateway
annotations:
cert-manager.io/cluster-issuer: letsencrypt-prod
# Streaming, timeout, and body-size settings are controller-specific.
# Replace these ingress-nginx keys with your controller's equivalents.
nginx.ingress.kubernetes.io/proxy-buffering: "off"
nginx.ingress.kubernetes.io/proxy-read-timeout: "300"
nginx.ingress.kubernetes.io/proxy-send-timeout: "300"
nginx.ingress.kubernetes.io/proxy-body-size: "100m"
spec:
ingressClassName: example-ingress-class
tls:
- hosts:
- llm.example.com
secretName: bifrost-tls
rules:
- host: llm.example.com
http:
paths:
- path: /
pathType: Prefix
backend:
service:
name: bifrost
port:
number: 8080
# Gateway API (gateway.networking.k8s.io/v1)
apiVersion: gateway.networking.k8s.io/v1
kind: Gateway
metadata:
name: ai-edge
namespace: ai-gateway
spec:
gatewayClassName: example-gateway-class
listeners:
- name: https
protocol: HTTPS
port: 443
hostname: llm.example.com
tls:
mode: Terminate
certificateRefs:
- name: bifrost-tls
---
apiVersion: gateway.networking.k8s.io/v1
kind: HTTPRoute
metadata:
name: bifrost
namespace: ai-gateway
spec:
parentRefs:
- name: ai-edge
hostnames:
- llm.example.com
rules:
- matches:
- path:
type: PathPrefix
value: /
backendRefs:
- name: bifrost
port: 8080
timeouts:
request: 300s
The timeouts.request field is an extended-support feature, so confirm the implementation supports it (the Gateway API HTTP timeouts guide also documents "0s" to disable it). Body size and buffering sit outside the core spec; set them through the implementation's policy resources and test with a streaming request.
The Helm chart can also render the Ingress itself from its ingress.* values, listed in the Helm values reference; set bifrost.server.basePath to serve Bifrost under a path prefix.
Before production traffic, send one streaming request through the public hostname and confirm that chunks arrive incrementally rather than in one block at the end:
curl --no-buffer <https://llm.example.com/v1/chat/completions> \
-H 'Authorization: Bearer <BIFROST_VIRTUAL_KEY>' -H 'Content-Type: application/json' \
--data '{"model":"<provider>/<model>","stream":true,"messages":[{"role":"user","content":"Reply in three chunks"}]}'
Rate Limiting at the Ingress Controller vs the AI Gateway
Rate limits at the ingress controller and at the AI gateway solve different problems, so production deployments use both. The ingress limits raw request volume per client IP or connection to protect the cluster; the AI gateway limits requests and tokens per identity, team, or customer to govern model spend.
An ingress controller sees IP addresses, hostnames, and request counts, not teams, tokens, or providers. Edge limits suit scanners, credential-stuffing attempts, and connection floods, rejecting them before they consume gateway resources.

Requests pass a per-IP edge limit at the Kubernetes ingress, then Bifrost request and token limits per virtual key, before reaching model providers
Figure 3: The edge limit protects the cluster; the AI gateway limit governs who spends which model capacity.
Bifrost AI gateway governance applies request limits and token limits in parallel as part of its budgets and rate limits, at the provider config, virtual key, team, and customer levels. Each caller authenticates with its own virtual key, so the limit follows the identity, not the source IP.
| Concern | Ingress or Gateway API edge | Bifrost AI gateway |
|---|---|---|
| Identity | Client IP, connection | Virtual key, team, customer |
| Unit | Requests, connections | Requests and tokens |
| Purpose | Protect cluster capacity | Govern model access and spend |
| Visibility | HTTP status and latency | Model, provider, tokens, cost |
| Multi-replica state | Per controller instance, depending on implementation | Shared across replicas in Enterprise cluster mode |
The last row matters once the gateway scales out: a per-minute limit enforced independently on three replicas allows up to three times the intended volume. Bifrost Enterprise syncs AI Governance counters across replicas in cluster mode, so one limit holds cluster-wide.
For per-team designs, see rate limiting LLM APIs with virtual keys and budgets and the AI governance resource hub.
Session Affinity, Health Checks, and Readiness Probes
Session affinity is unnecessary for ordinary inference requests to Bifrost replicas: any correctly configured replica can serve any request, so the ingress can balance freely. What matters more is routing only to ready pods, using the GET /health endpoint on port 8080, and draining streams before a pod terminates.
Sticky sessions concentrate long streams on a few pods and slow rebalancing after a scale-out. Spread load across replicas, and leave provider-side balancing to load balancing in the AI gateway across keys and providers.
The /health endpoint returns 200 once Bifrost is ready and, by default, 503 when a configured config, log, or vector store check fails, which removes the pod from the backend pool. The Helm chart ships these defaults:
- Readiness probe: starts after 10 seconds, runs every 10 seconds, 5-second timeout.
- Liveness probe: starts after 30 seconds, runs every 30 seconds, 5-second timeout.
- Termination: a 60-second grace period, including a 15-second
preStopdelay.
For stream-heavy workloads, the Bifrost cluster mode guide for Helm raises the grace period to 90 seconds with a conservative scale-down policy.
Deploying Bifrost Behind Kubernetes Ingress
The open-source Bifrost gateway runs as a long-lived container behind an Ingress or Gateway API edge, installed with an official Helm chart and listening on port 8080. It stays inside the cluster and VPC, only the edge is exposed, and existing applications move to it by changing their SDK base URL to the ingress hostname.
Bifrost is a self-hosted single binary, and its Helm chart installs on any compatible cluster, with platform guides for EKS, GKE, and AKS. A minimal install:
helm repo add bifrost <https://maximhq.github.io/bifrost/helm-charts>
helm install bifrost bifrost/bifrost --set image.tag=<version> \
--set bifrost.encryptionKeySecret.name=bifrost-encryption-key \
--set bifrost.encryptionKeySecret.key=encryption-key
OSS with SQLite runs one replica; OSS with a shared, immutable config.json can run several. Enterprise deployments use PostgreSQL 16 or later and Bifrost clustering, a peer-to-peer design that tracks membership over gossip on port 10101 (TCP and UDP) and syncs configuration and governance counters over gRPC on port 10102, so NetworkPolicies must allow both between pods. The Bifrost cluster mode deep dive covers rolling updates and failover.

External clients reach Bifrost replicas through the Kubernetes ingress while in-cluster apps call the Bifrost Service directly; Bifrost stores config and logs in PostgreSQL and calls model providers
Figure 4: Only the ingress is exposed; Bifrost replicas, their database, and in-cluster callers stay inside the VPC.
Bifrost is air-gapped by default: no prompts, responses, files, or telemetry leave the customer's infrastructure, in-VPC deployments run on the major clouds, and compliance covers SOC 2 Type II, ISO 27001, HIPAA, and GDPR. The Bifrost Enterprise page covers regulated-industry patterns.
The guide to deploying Bifrost on Kubernetes with Helm walks through the chart, and the enterprise deployment resource covers VPC and on-prem topologies.
Applications connect through the ingress hostname with a drop-in SDK replacement: change the base URL and keep the rest of the code.
from openai import OpenAI
client = OpenAI(
base_url="<https://llm.example.com/openai>", # the ingress host in front of Bifrost
api_key="<BIFROST_VIRTUAL_KEY>",
)
The same pattern works for the Anthropic and Google GenAI SDKs and LangChain. Behind that endpoint, the Bifrost LLM gateway reaches 10,000+ models across 35+ providers through one OpenAI-compatible API.
Frequently Asked Questions
What does ingress mean?
Ingress means the act of entering. In networking it describes traffic coming into a system, while egress describes traffic leaving it. In Kubernetes, Ingress is a specific API object that routes external HTTP and HTTPS requests to Services inside a cluster through rules that an ingress controller implements.
Is Kubernetes Ingress deprecated?
No. Kubernetes Ingress is generally available and the Kubernetes project has no plans to remove it. The API is frozen, so it gets no new features, and the project recommends the Gateway API for new work. The retirement of the Ingress NGINX controller in 2026 is a separate change from the Ingress API itself.
What is the difference between Ingress and an ingress controller?
An Ingress is a declarative resource that lists routing rules. An ingress controller is the running software, typically a reverse proxy or cloud load balancer integration, that reads those rules and enforces them. Creating an Ingress without a controller has no effect, and controllers differ in the annotations they accept for timeouts and buffering.
Should I use Ingress or the Gateway API in front of an AI gateway?
Use the Gateway API for new clusters when the implementation supports request timeouts and unbuffered streaming, and keep a maintained Ingress controller where one already works. Bifrost needs the same edge behavior either way: unbuffered SSE, long read timeouts, a matching body limit, preserved forwarded headers, and readiness checks on /health.
Do streaming LLM responses need session affinity?
No. Each streamed response travels over one HTTP connection, so it stays on one pod without sticky sessions, and any Bifrost replica can serve any inference request. Spread traffic evenly and rely on connection draining and adequate grace periods so scale-down does not cut active streams.
How do I point an existing SDK at Bifrost behind an ingress?
Set the SDK base URL to the ingress hostname plus the provider path, for example https://llm.example.com/openai, and authenticate with a Bifrost virtual key. Include any server.basePath prefix in the URL. The on-premise LLM deployment reference architecture shows where that endpoint fits in a private stack.
Getting Started with Bifrost on Kubernetes
Kubernetes Ingress, or the Gateway API, decides how AI traffic enters the cluster; Bifrost decides where it goes and who may send it. Configure the edge for unbuffered streams, long timeouts, and matching body limits, and keep routing and per-key governance inside the VPC. To see Bifrost running behind your ingress with your providers and policies, book a demo with the Bifrost team, or browse the Bifrost resources library for deployment patterns.