Gateway
Gateway (gateway) exposes model endpoints securely. It installs Gateway API with a GatewayClass named astro, and Envoy Gateway behind it. With it installed, an exposed Model application is served through the gateway over HTTPS instead of an Ingress, with nothing changed on the application. It is the only path that enforces a model's access policy: API keys or tokens are checked here, before a request reaches the model. It needs Certificates.
When to use it
- A model endpoint must answer only callers you allow. Without the gateway, a model with an access policy is refused with Authenticated endpoints need the gateway add-on. With it, every request is checked against the policy before it reaches the model.
- Some models are public and some private, on one cluster. With
externalAccess.exposureon each model, public endpoints (the internet) and private ones (only the cluster's network) are served side by side. - Many model endpoints share one entry point that has to keep up. Every model routes through one proxy, which can scale on CPU or on request rate.
You don't need it for image applications, for a model with no access policy, which Ingress can expose, or for a model reached only inside the cluster.
Before you start
- A cluster on Kubernetes 1.30 or newer.
- Certificates with an issuer. For Let's Encrypt, Certificates needs its DNS check: Let's Encrypt can't check names over HTTP behind the gateway (How a certificate is checked). A self-signed issuer works with no extra step.
- On a cluster with no cloud load balancer, such as a local or bare-metal one, plan to turn on Enable node port.
In the console
After Version, its steps are Settings and Auto scaling, then Advanced, Resources and Components. Review runs the dry run, and Ask Nova at the top of the steps answers about the open step.
-
Open the cluster from the cluster list, select the Add-ons tab, then Install Add-on, and pick Gateway. Requires shows whether Certificates is installed.
-
Under Auto scaling, turn on Enabled for production. With it off, the proxy runs 2 copies on a cluster AstroPulse created with 2 or more fixed nodes, and 1 otherwise. Then pick the Metric: CPU, or Requests per second (needs Workload Autoscaling), and set Min replicas, Max replicas and Target CPU percent or Target requests per second.
Open zoom view -
Optional: Exposure, and Enable node port for a cluster with no cloud load balancer.
-
On Review, the dry run runs by itself; select Continue to deploy once it passes, then Deploy gateway.
You should see
The add-on reads Deployed, and its Overview shows the address to point clients at under Access, or the node ports and node addresses with Enable node port on. astroctl infra k8s addons get <cluster> gateway reports the same, with endpointAuthentication, the methods this version enforces (jwt, apiKeys).
How it serves models
- Exposure. A model's
externalAccess.exposurepicksPublic(the internet) orPrivate(only the cluster's network). A model that names none gets the add-on'sexposure,Publicby default. - DNS. Turn on Gateway routes (
gatewayRoutes) on DNS Automation to publish each route's hostname. - Request duration. Each model route times out a request after 300 seconds, while capacity scales too. The gateway is not a request queue: size the model's maximum replicas for its longest request.
- Scaling is separate. Scaling the proxy adds gateway replicas to accept more calls; it adds no model replicas or GPU nodes. How they fit together: Workload Autoscaling.
Security: with the default exposure, the gateway is on an internet-facing cloud load balancer, billed by your cloud. Set exposure: Private when no model on the cluster should be reachable from the internet; only the gateway checks access policies, so a model that needs one is never served through Ingress.
Run it in production
Every exposed model's traffic passes through its proxy, so treat it as critical.
- Scale the proxy. Under Auto scaling, turn on Enabled with Min replicas of 2 or more. With it off, the proxy runs 2 copies on a cluster AstroPulse created with 2 or more fixed nodes, and 1 otherwise.
- Load balancers are billed by your cloud. The public one exists while the add-on is installed. The first model served privately adds a second, internal load balancer.
- It grows with traffic. The proxy reserves 100m CPU and 256Mi memory, with no memory limit. Raise Resources as traffic grows: Availability and resources.
- Scaling on requests per second needs Workload Autoscaling. While the gateway scales that way, uninstalling Workload Autoscaling is refused. Switch the gateway to CPU first.
Other ways in
- Nova: ask it, for example "install the Gateway on eks-prod and scale the proxy between 2 and 10 replicas on CPU".
- SDK and API: the same operations, in the API reference.
With astroctl
apiVersion: platform.astropulse.io/v1
kind: K8sClusterAddon
metadata:
name: gateway
spec:
clusterName: eks-prod
configuration:
gateway:
autoScaling:
enabled: true
metric: CPU
minReplicas: 2
maxReplicas: 10
astroctl infra k8s addons apply -f gateway.yaml --dry-run
astroctl infra k8s addons apply -f gateway.yaml
astroctl infra k8s addons template <cluster> gateway writes every setting with what it does.
Settings
Its own settings, under gateway, plus availability and resources. Every one is optional.
gateway.autoScaling.enabledScales the proxy every exposed model's traffic goes through.
gateway.autoScaling.metricThe one signal replicas follow. RequestsPerSecond needs Workload Autoscaling with a Prometheus that scrapes the proxy; without it the apply is refused, never moved to CPU.
CPUCPU Replicas follow the gateway's CPU use.RequestsPerSecondRequests per second Replicas follow the requests the gateway serves each second; needs the Workload Autoscaling add-on with a metrics source.
CPU
gateway.autoScaling.minReplicasgateway.autoScaling.maxReplicasgateway.autoScaling.targetCPUPercentThe CPU use to hold, with CPU.
gateway.autoScaling.targetRequestsPerSecondThe request rate per replica to hold, with RequestsPerSecond.
gateway.enableNodePortPublishes the gateway on a NodePort on every node instead of a cloud load balancer, for clusters that have none. The HTTP listener is on node port 30089.
gateway.exposureThe exposure of the shared gateway, and the default for model endpoints that name none. Private needs a cloud load balancer.
PublicPublic Reachable from the internet.PrivatePrivate Reachable only from inside the cluster's network.
Public
If it's refused
exposure: Private with Enable node port on.Public.These come on a model application's dry run and apply: