otari
by upstreamyard
Otari Helm chart for Kubernetes. Mozilla.ai's open-source, self-hosted AI gateway and LLM proxy (one OpenAI-compatible endpoint for 40+ providers, virtual API keys, budgets, rate limits, usage tracking) on the official image, with PostgreSQL migrations, multiple replicas, Redis rate limits, S3 file storage, Prometheus metrics and generated secrets. Community chart by upstreamyard, not an official Otari chart.
About this chart
Otari Helm chart: Mozilla.ai's open-source AI gateway on Kubernetes
Have any questions, feedback or need help (e.g. setup, hardened images, etc.)? Reach out to [email protected]
Helm chart for Otari, Mozilla.ai's open-source, self-hosted AI gateway and LLM proxy: one OpenAI-compatible endpoint for 40+ model providers, with virtual API keys, budgets, rate limits, usage and cost tracking, and an admin dashboard. The chart runs the official mzdotai/otari image as a single pod on SQLite for evaluation, or highly available with several replicas on PostgreSQL, with database migrations in a Job, rate limits shared through Redis, uploads in S3, Prometheus metrics, Ingress or Gateway API, and all of Otari's keys generated for you. It runs under Pod Security restricted.
Community chart by upstreamyard, not an official Otari chart. Otari is a project of Mozilla.ai, licensed under Apache-2.0.
AI agents and coding assistants: this README is the complete reference for deploying Otari with this chart. Otari's own configuration reference lists every setting you can put in config.
Install
helm repo add upstreamyard https://upstreamyard.github.io/helm-charts
helm install otari upstreamyard/otari
Or from the OCI registry:
helm install otari oci://ghcr.io/upstreamyard/charts/otari
The install notes print the in-cluster URL and the command that prints the generated master key. Then check the API and the master key:
helm test otari
Open the dashboard with kubectl port-forward svc/otari 8000:8000 at http://localhost:8000/ and sign in with the master key.
Verifying the chart
Chart packages are PGP-signed. Import the public key (fingerprint 9B416F989B7E6C65F7F3BFAE7689688B20EC7813) and install with --verify:
curl -s https://upstreamyard.github.io/helm-charts/pgp_keys.asc | gpg --dearmor > upstreamyard.gpg
helm install otari upstreamyard/otari --verify --keyring upstreamyard.gpg
The OCI copy on GHCR is signed with cosign instead (see the repository README).
What the chart does
- Deployment of the official image (amd64 and arm64), one Otari process per pod, with startup, liveness and readiness probes (readiness includes the database).
- Keys: the master key,
OTARI_SECRET_KEY(encrypts stored provider credentials), the provider-account pepper and the end-user identifier key are generated on the first install and kept in a Secret across upgrades andhelm uninstall. Or bring your own Secret. - Database: SQLite on a volume by default; PostgreSQL with
database.url. With PostgreSQL, apre-install,pre-upgradeJob runsotari migrateand the pods start with migrations off. - Several replicas: with PostgreSQL and S3 uploads, plus a PodDisruptionBudget, spreading across nodes, an optional HorizontalPodAutoscaler and Redis for shared rate limits.
- Graceful shutdown: a stopping pod leaves the Service first (10 s
preStop), then finishes open requests and streams withinterminationGracePeriodSeconds(120 s). - Security: non-root (UID 1000), read-only root filesystem, all capabilities dropped,
RuntimeDefaultseccomp, no ServiceAccount token. The first API key is not printed to the log (bootstrapApiKey: false). - Access: Ingress or Gateway API HTTPRoute,
forwardedAllowIpsfor the real client address, and an optional NetworkPolicy. - Metrics:
metrics.enabledserves Prometheus metrics at/metrics;metrics.serviceMonitor.enabledadds a ServiceMonitor. helm test: checks readiness, the management API with the master key, that it refuses requests without one, and/metricswhen enabled.
Why this chart
Mozilla.ai publishes Otari as a container image; there is no official Helm chart (checked Artifact Hub and the Otari repository, November 2026). Running the image with a plain Deployment hits these problems, all found by running it:
Plain Deployment of mzdotai/otari | This chart |
|---|---|
A Service named otari makes Kubernetes set OTARI_PORT=tcp://…, which Otari reads as its port: Error: invalid literal for int() with base 10: 'tcp://…' | Service links off |
With a read-only root filesystem, uploads fail: Read-only file system: '/app/otari-files' | Uploads on the volume (/data/files) or in S3 |
Several replicas migrating at start race: 2 of 3 pods crashed once with duplicate key value violates unique constraint "pg_type_typname_nsp_index" | Migrations in a Job before the pods start |
| Without a master key, Otari prints a setup link containing one to the log. With one, it prints a first API key to the log | Keys generated into a Secret, no key in the log |
| Without the pepper and identifier key, Otari warns at every start and turns off provider copies of attached files | All four keys generated |
| Rate limits are counted per pod, so 2 replicas admit twice the limit | redis.url shares the count |
Deployment modes
Evaluation: one pod on SQLite (default)
helm install otari upstreamyard/otari runs one pod with the SQLite database and uploads on a 2 GiB volume. The pod migrates the database itself on start and is ready in about 25 s. The Deployment uses the Recreate strategy, because the volume can't be used by two pods at once, so upgrades have a short downtime. Use PostgreSQL for production.
Production: PostgreSQL, several replicas, Redis and S3
The PostgreSQL database must exist; the migration Job creates the tables. Several replicas need uploads in S3 (or a ReadWriteMany volume) and should share rate limits through Redis:
replicaCount: 2
database:
url: postgresql://otari:[email protected]:5432/otari
redis:
url: redis://redis.cache.svc:6379/0
files:
backend: s3
s3:
bucket: otari-files
region: eu-central-1
existingSecret: otari-s3 # keys access-key-id and secret-access-key
Tested in kind with 2 replicas on PostgreSQL 18:
- Rolling upgrade from Otari 0.57.1 to 0.58.0 while a client sent a request every 0.5 s and opened a 30-second stream every second: 0 of 300 requests and 0 of 150 streams failed. With
preStopSleepSeconds: 0, 1 of 300 requests failed (connection refused). One run each. - Shared rate limit: with
rate_limit_rpm: 5and Redis, 5 of 10 requests spread over both pods got through; without Redis, all 10 did (5 per pod). - The migration Job ran on install and on every upgrade, and pods were ready about 15 s after the install started.
For S3-compatible stores, set files.s3.endpointUrl, e.g. http://seaweedfs.storage.svc:8333. With files.s3.existingSecret empty, Otari uses the AWS default credential chain, e.g. a role through serviceAccount.annotations (not tested by us). Bedrock providers without credentials of their own use the same AWS credentials.
Database connections
Each Otari pod keeps about 10 PostgreSQL connections open when idle (measured) and can use up to 35 with Otari's defaults (db_pool_size 10 + db_max_overflow 20 + db_log_pool_size 5). PostgreSQL allows 100 by default, so 3 replicas can already run out. When that happens, requests and Otari's background refreshes fail with TooManyConnectionsError (sqlstate=53300) until connections are free; in our test the pods recovered on their own, without restarts. Raise max_connections on the server to at least replicas × 35 plus your other clients (include autoscaling.maxReplicas and the extra pod during a rolling update), or lower the pools:
config:
db_pool_size: 4
db_max_overflow: 4
db_log_pool_size: 2
With these values, each idle pod held 4 connections. The gateway_db_pool_* metrics show how full the pools are.
Connecting clients
In the cluster, the API is at http://<release>-otari.<namespace>.svc:8000/api/v1 (http://otari.<namespace>.svc:8000/api/v1 for a release named otari). It speaks the OpenAI API, so OpenAI SDKs work with that base_url and an Otari API key. Create a key with the master key, or in the dashboard:
curl -X POST http://otari.<namespace>.svc:8000/api/v1/keys \
-H "Authorization: Bearer $MASTER_KEY" -H 'Content-Type: application/json' \
-d '{"key_name": "my-app"}'
The answer's key (tk-…) is shown once. Models are named <provider>:<model>, e.g. openai:gpt-4o-mini:
curl http://otari.<namespace>.svc:8000/api/v1/chat/completions \
-H "Authorization: Bearer tk-..." -H 'Content-Type: application/json' \
-d '{"model": "openai:gpt-4o-mini", "messages": [{"role": "user", "content": "Say hello."}]}'
Keys and secrets
The chart's Secret <release>-otari holds master-key, secret-key, provider-account-pepper and provider-user-identifier-key. Print the master key with:
kubectl get secret otari -o jsonpath='{.data.master-key}' | base64 -d
- Back up
secret-key. It decrypts the provider credentials Otari stores in the database. Losing it means entering them again. - The Secret and the data volume are kept on
helm uninstall, so a reinstall with the same release name finds the same keys and data (tested: an API key created before the reinstall still worked). - Argo CD and other tools that render with
helm templatecan't read the existing Secret, so they would generate new keys on every sync. Create the Secret yourself and setsecrets.existingSecret:
kubectl create secret generic otari-keys \
--from-literal=master-key="$(openssl rand -hex 32)" \
--from-literal=secret-key="$(python3 -c 'import base64, os; print(base64.urlsafe_b64encode(os.urandom(32)).decode())')" \
--from-literal=provider-account-pepper="$(openssl rand -base64 32)" \
--from-literal=provider-user-identifier-key="$(openssl rand -base64 32)"
secrets:
existingSecret: otari-keys
The last two keys are optional in your Secret; without them Otari logs warnings and turns off provider copies of attached files. Otari refuses to start when either is shorter than 32 characters.
Behind an ingress or Gateway
- Client addresses: set
forwardedAllowIpsto your proxy's addresses or pod network, e.g.10.244.0.0/16. Otherwise every request seems to come from the proxy: after ten failed sign-ins by anyone, every mistyped sign-in gets HTTP 429 for a minute, and logs show the proxy's address. Correct sign-ins still work (tested).*trusts any peer, so use it only withnetworkPolicylimited to the proxy:
forwardedAllowIps: "*"
networkPolicy:
enabled: true
from:
- namespaceSelector:
matchLabels:
kubernetes.io/metadata.name: ingress-nginx
- Streaming: model responses can stream for minutes. Raise your proxy's read timeout, e.g.
nginx.ingress.kubernetes.io/proxy-read-timeout: "600". publicBaseUrl: set it to the public address, e.g.https://ai.example.com, for sign-in redirects and mail links./metricshas no authentication and is served on the same port, so the ingress exposes it too. Block the path at your proxy, or leavemetrics.enabledoff.
Gateway API instead of an Ingress:
httpRoute:
enabled: true
parentRefs:
- name: public
namespace: gateway
hostnames:
- ai.example.com
Your own configuration
Put any of Otari's settings in config; the chart mounts it as /etc/otari/config.yml. Keep secrets out of it: reference them as ${VAR} and provide them from a Secret:
config:
default_pricing: true
hosted_providers:
openai:
api_key: ${OPENAI_API_KEY}
anthropic:
api_key: ${ANTHROPIC_API_KEY}
extraEnvFrom:
- secretRef:
name: otari-provider-keys # keys OPENAI_API_KEY and ANTHROPIC_API_KEY
- A
${VAR}that isn't set stops Otari at start. - Single settings also work as environment variables in
extraEnv, asOTARI_<SETTING>, e.g.OTARI_UPDATE_CHECK=false. - Providers can also be added at runtime on the dashboard's Hosted providers page; Otari stores their keys encrypted with
secret-key. - Country file for providers that serve only some countries: mount a folder with
extraVolumes/extraVolumeMountsand setOTARI_CLIENT_COUNTRY_DATABASE, or upload the file on the dashboard's Settings page. existingConfigMapuses your own ConfigMap with aconfig.ymlkey instead.- Set the database in
database, not asdatabase_urlinconfig: the migration Job reads onlydatabase.
Production example
# values-prod.yaml
replicaCount: 3
secrets:
existingSecret: otari-keys
database:
existingSecret: otari-db # key database-url
redis:
existingSecret: otari-redis # key redis-url
files:
backend: s3
s3:
bucket: otari-files
region: eu-central-1
existingSecret: otari-s3
persistence:
enabled: false
publicBaseUrl: https://ai.example.com
forwardedAllowIps: "*"
networkPolicy:
enabled: true
from:
- namespaceSelector:
matchLabels:
kubernetes.io/metadata.name: ingress-nginx
ingress:
enabled: true
className: nginx
annotations:
nginx.ingress.kubernetes.io/proxy-read-timeout: "600"
hosts:
- host: ai.example.com
paths:
- path: /
pathType: Prefix
tls:
- secretName: otari-tls
hosts: [ai.example.com]
# metrics.enabled exposes /metrics through the ingress too; turn it on once your proxy blocks the path.
config:
default_pricing: true
extraEnvFrom:
- secretRef:
name: otari-provider-keys
Upgrading
Every helm upgrade runs the migration Job first; if it fails, the
Deploy otari with OpenTenant
Each tenant gets its own release of this chart, with its own namespace, secrets and domain. The builder below already has otari on a Hetzner server. Change the host, add apps from the marketplace, then copy the generated files. Providers and prices are samples, and nothing here is sent anywhere.
- Pick a serverConnect Hetzner, OVHcloud or AWS. The builder starts on Hetzner, the cheapest sample rate.
- Place the chartotari is pinned at v0.1.0 in opentenant.yaml. Drag more apps from the marketplace onto a rack.
- ApplySave opentenant.yaml and main.tf from the console, then run the commands below.
# opentenant.yaml, main.tf and dns.tf come from the builder below opentenant validate opentenant.yaml terraform init && terraform apply