Skip to main content

Regions reference

The detail behind Install a region and Regions: other ways to expose a region, the scripted and GitOps installs, the database, network rules, and what each status means.

Exposing a region​

Employee machines stream answers from the region for up to an hour and send request bodies up to 32 MB, all over https://<region-hostname>. Whatever sits in front of the gateway has to allow both. The install guide uses ingress-nginx, and the chart sets its timeouts and body size for you.

RouteWho creates the load balancerWhat to set
ingress-nginx + cert-manageringress-nginx's LoadBalancer Service (an NLB on EKS)Nothing extra (install guide)
Gateway APIYour existing GatewayThe values below; the certificate lives on the Gateway listener. The chart sets the route's request timeout.
AWS ALBAWS Load Balancer Controlleringress.className: alb, and in ingress.annotations: alb.ingress.kubernetes.io/scheme: internet-facing, target-type: ip, certificate-arn: <ACM ARN>, load-balancer-attributes: idle_timeout.timeout_seconds=3600
AKS Application GatewayApplication Gateway Ingress Controlleringress.className: azure-application-gateway, and appgw.ingress.kubernetes.io/request-timeout: "3600" in ingress.annotations

Two routes do not work with the chart. GKE's gce Ingress cuts every stream at 30 s, and its fix, a BackendConfig on the gateway Service, needs a Service annotation the chart does not set. A gateway.service.type: LoadBalancer serves plain http on 8787, and ending TLS at the load balancer needs Service annotations too.

my-values.yaml (Gateway API)
topology: region
host: "<region-hostname>"
image:
tag: policy-stable
ingress:
enabled: false
httpRoute:
enabled: true
parentRefs:
- name: my-gateway
namespace: gateway-system # omit if the Gateway is in this namespace
sectionName: https # a specific listener on the Gateway (optional)
postgres:
storage: 150Gi

Every path goes to the region's gateway; a region serves no console.

Scripted quickstart with setup.sh​

setup.sh --k8s --region writes both files for you: a Secret with the token and two fresh random values, and a starting my-values.yaml. It reads the token from the environment, never the command line, and it needs git and openssl.

Generate the Secret and values file
git clone https://github.com/anyrayHQ/install anyray && cd anyray
read -rs ANYRAY_REGION_TOKEN && export ANYRAY_REGION_TOKEN # paste the arr_… token, press Enter
./setup.sh --k8s --region --host <region-hostname> --namespace "$ANYRAY_NAMESPACE"
unset ANYRAY_REGION_TOKEN
# Emits: anyray-secrets.yaml my-values.yaml

read -rs keeps the token off the screen and out of shell history. A token already in a file (from a secret store, say) goes in with --region-token-file <path> instead.

The generated my-values.yaml leaves ingress.className, the cert-manager annotation and tls commented out: fill them in as in the values file step, then apply the Secret and install the chart the same way. Do not commit anyray-secrets.yaml.

Install with Argo CD​

Point an Argo CD Application at the chart repo. The anyray-secrets Secret stays out of band, created by your secret tooling as in the install steps.

anyray-region-application.yaml
apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
name: anyray-region
namespace: argocd
spec:
project: default
source:
repoURL: https://charts.anyray.ai
chart: anyray
targetRevision: <x.y.z> # a chart version with region support
helm:
valuesObject:
topology: region
host: "<region-hostname>"
image:
tag: <vX.Y.Z> # home's build; never newer than home
ingress:
enabled: true
className: nginx
annotations:
cert-manager.io/cluster-issuer: letsencrypt-prod
tls:
- secretName: anyray-region-tls
hosts:
- "<region-hostname>"
postgres:
storage: 150Gi # immutable after the first sync
destination:
server: https://kubernetes.default.svc
namespace: team-ai
kubectl apply -n argocd -f anyray-region-application.yaml

Pin image.tag to home's build so Git decides what runs, and raise it after home's upgrade (Updates). The policy-stable channel under Argo CD, and the storage-floor line an existing small volume needs, work as for home: Kubernetes reference.

Managed Postgres​

A region can use a managed database (RDS, Cloud SQL, Azure Database for PostgreSQL) in place of the bundled one. Put the URL in its own Secret:

kubectl create secret generic anyray-region-db -n "$ANYRAY_NAMESPACE" \
--from-literal=DATABASE_URL='postgresql://anyray:<password>@<db-host>:5432/anyray?sslmode=require'

Then replace the postgres block in my-values.yaml:

my-values.yaml
postgres:
enabled: false
external:
databaseUrlSecretKeyRef:
name: anyray-region-db
key: DATABASE_URL

Allow both the gateway and the optimizer pods through the database's firewall. TLS modes, password encoding and RDS IAM auth: Managed Postgres.

Network rules​

FromToWhy
Employee machinesRegion hostname, 443Inference and Connect checks
Region podsHome's public address, 443Settings, keys and usage
Region gateway and optimizerRegion database, 5432Its own store

The chart also creates the ClusterIP Service gateway-internal on port 8789. The region optimizer and the update job use it. Never route it from an Ingress or an HTTPRoute. With networkPolicy.enabled, only those pods reach it.

The chart refuses home-only variables in gateway.extraEnv or optimizer.extraEnv under topology: region: ANYRAY_ADMIN_TOKEN, ANYRAY_DEPLOYMENT_TOKEN, ANYRAY_CONTENT_KEY, ANYRAY_METERING_ENABLED, ANYRAY_PSEUDONYM_SALT and ANYRAY_OBSERVABILITY_DB_URL.

Region health reasons​

GET /region-health answers {"ready":true} with 200, or 503 with one reason. A late budgets or usage copy stops only the requests that read it, so the region stays ready and names the copy in limited:

limitedWhat it stops
budgets lateRequests from people and agents with a hard spending limit answer 503 until the copy refreshes. Everyone else is served.
usage lateRequests from people with a monthly token cap answer 503 until the totals refresh, and so does every request when the deployment has a monthly spend cap. Everyone else is served.

While either one shows, Connect moves machines to home, and home's Health page reads the region as Partly serving. If it lasts more than a few minutes, check home's Health page.

The 503 reasons:

reasonWhat to do
home predates regionsUpdate home to v1.10.625 or newer.
home build unknownHome has not told the region its build, or one of its pods runs a build below v1.10.625. Finish updating home to v1.10.625 or newer. If home is current, this clears by itself within a minute or two.
region newer than homeThe region runs a newer build than home. Update home. With image.tag: policy-stable the update job moves the region down to home's build, and the region then becomes ready on its own.
key material loading, keys loading, config loadingThe first copy from home is in progress. If it stays, check the region can reach home over https.
keys stale, config staleThe region has not reached home lately. Check egress to home's address.
lease unavailableThe region has no valid lease from home. Check it reaches home.
database unavailableThe region's Postgres is down or unreachable. Check its pod, or the external URL and firewall.
clock skewThe node clocks and the database clock disagree. Fix time sync on the nodes.
awaiting first acceptHome has not accepted the region's first usage batch yet. Normal for a minute after install.
outbox full, outbox halted, outbox writes failing, outbox unknown at homeUsage is not reaching home. Check the region's row on home's Regions page and home's Health page. A region newer than home stops here: update home.
drainingThe region is draining or closing. Reopen it on home's Regions page to serve again.
copy too largeA copy from home is over its size limit. Contact Anyray support.

Regions page statuses​

LabelMeaning
Never connectedThe region has not reached home since it was added. Its URL reads Not announced.
ConnectedThe region reached home in the last 30 seconds.
Disconnected · last seenThe region has missed its syncs since then.
DrainingNew sessions go elsewhere; running ones finish. Close unlocks at 0 active sessions.
Closing, SealedThe region stopped taking requests and is sending its last usage.
Ready to removeRemove will succeed.
Rows refused after sealSome usage never reached home. Only Remove anyway is left.
Queue behind, Queue blocked, Queue fencedUsage is waiting or stopped on the way home. A blocked queue names the write and the reason.
Erase pendingThe region has not applied an erase request yet.