Skip to content

Kubernetes

deploy/helm/zentri is a Helm chart for the coordinator. It runs the same steps as Docker Compose: migrations as the database owner, then the coordinator as zentri_coordinator. This page explains what it runs, how to install it, and what to set before anyone relies on it.

Object When What it does
Deployment, init container migrate Always, unless migrations.enabled=false Runs zentri-server migrate up as the database owner, then exits.
Deployment, container coordinator Always Runs zentri-server serve --no-migrate as zentri_coordinator, on port 8080.
Service Always ClusterIP on port 8080 by default.
Ingress ingress.enabled=true Routes a host to the Service.
ConfigMap Always The non-secret settings, as ZENTRI_* variables.
Secret Only for secrets you pass as values Each secret you give as a value. None when every secret is an existingSecret.
ServiceAccount serviceAccount.create=true (default) Mounts no token. No pod calls the Kubernetes API.
NetworkPolicy networkPolicy.enabled=true One per pod the chart runs. See Network policies.
StatefulSet <release>-postgresql postgresql.enabled=true One Postgres for evaluation. See Try it.
Deployment <release>-ollama ollama.enabled=true Local models. See Local models with Ollama.

The chart runs one coordinator and replaces it with the Recreate strategy: the old pod stops before the new one migrates and starts. Expect a short outage on every upgrade. More than one coordinator on one database is not tested.

Every pod runs as a non-root user with a read-only root file system, every Linux capability dropped, no privilege escalation, the RuntimeDefault seccomp profile, no service account token and no service links. make test-helm checks each of these on every container and pod the chart renders.

  • Kubernetes 1.35, 1.36 or 1.37. The chart is checked against each with kubeconform, and installed on 1.37 in a kind cluster. Other versions are not refused, only untested.
  • Helm 3 or Helm 4. The chart is apiVersion: v2. Its checks run with Helm v4.3.2.
  • An image of the coordinator in a registry your nodes can pull from.
  • For the evaluation Postgres or Ollama, a default StorageClass, or set persistence.storageClass.
  • For network policies, a network plugin that enforces them.

Until the image is published, build it from a checkout and push it to your registry:

Terminal window
docker build -f server/Dockerfile -t registry.example.com/zentri-server:0.1.0 .
docker push registry.example.com/zentri-server:0.1.0

Then pass --set image.repository=registry.example.com/zentri-server --set image.tag=0.1.0, or pin it with --set image.digest=sha256:.... Without a tag, the chart uses its appVersion.

postgresql.enabled=true runs one pgvector/pgvector:pg16 pod with one volume, so you can try the chart without a database.

  1. Make a Secret with the two database passwords. They go into database URLs, so they must use only letters, digits, and . _ ~ -.

    Terminal window
    kubectl create namespace zentri
    kubectl -n zentri create secret generic zentri-postgres \
    --from-literal=postgres-password="$(openssl rand -hex 24)" \
    --from-literal=app-password="$(openssl rand -hex 24)"
  2. Install:

    Terminal window
    helm install zentri deploy/helm/zentri --namespace zentri \
    --set postgresql.enabled=true \
    --set postgresql.auth.existingSecret=zentri-postgres \
    --set image.repository=registry.example.com/zentri-server \
    --set image.tag=0.1.0 \
    --wait

Postgres runs deploy/postgres/init on its first start. It creates the vector and pg_trgm extensions and zentri_coordinator with the app password. The chart’s copy of those scripts must match deploy/postgres/init, and make lint-helm fails when they differ.

Until Postgres accepts connections, the migrate init container fails and Kubernetes restarts it. A few restarts on the first install are expected.

Your database needs Postgres 16 with the vector (pgvector) and pg_trgm extensions, and two login roles:

  • The owner, which owns the tables and runs migrations. Migrations create the NOLOGIN roles zentri_app and zentri_retention, and give zentri_retention two functions, so the owner must be a superuser, or have CREATEROLE and be a member of zentri_retention.
  • zentri_coordinator, which the coordinator serves as. It is a member of zentri_app and nothing else.

As a role that can create roles and extensions, run once:

CREATE EXTENSION IF NOT EXISTS vector;
CREATE EXTENSION IF NOT EXISTS pg_trgm;
CREATE ROLE zentri_app NOLOGIN;
CREATE ROLE zentri_retention NOLOGIN;
GRANT zentri_retention TO zentri; -- the owner, unless it is a superuser
CREATE ROLE zentri_coordinator LOGIN IN ROLE zentri_app PASSWORD '<app password>';

On a managed Postgres, the admin role it gives you usually has CREATEROLE. Check that your provider lists pgvector. See Requirements and sizing and Database roles.

The chart has no default for any secret. Put each one in a Secret you make, and the chart only names it. Keep these files out of git, or make the Secrets with your secret manager.

Terminal window
kubectl -n zentri create secret generic zentri-db \
--from-literal=database-url='postgres://zentri_coordinator:<app password>@db.internal:5432/zentri?sslmode=verify-full' \
--from-literal=migrate-database-url='postgres://zentri:<owner password>@db.internal:5432/zentri?sslmode=verify-full'
kubectl -n zentri create secret generic zentri-app \
--from-literal=bootstrap-admin-token="zt_a_$(openssl rand -base64 64 | tr -dc 'A-Za-z0-9' | cut -c1-43)" \
--from-literal=data-key="$(openssl rand -hex 32)"

These commands put the URLs in your shell history. Read them from a file with --from-file instead when that matters.

Secret key Chart setting What it is
database-url database.existingSecret, database.urlKey The URL the coordinator serves with, as zentri_coordinator.
migrate-database-url database.migrateUrlKey The owner’s URL. Only the migrate init container reads it.
bootstrap-admin-token bootstrapAdminToken.existingSecret The first admin token: zt_a_ and 43 letters and digits. Optional.
data-key dataKey.existingSecret The 32-byte key that encrypts raw prompts. Without it, raw prompts are not kept and the LLM judge is off.
embed-api-key, llm-api-key models.embedApiKey, models.llmApiKey API keys for hosted models. Optional.

The coordinator reads the token and the keys as files, mounted read-only at /etc/zentri/secrets with mode 0440. The two database URLs reach it as environment variables from the Secret, because the server reads them only from the environment.

Each secret can also be given as a value, such as --set dataKey.value=.... The chart then makes one Secret for those values. Helm keeps every value in its release record, so anyone who can read Secrets in the namespace can read them. Prefer existingSecret.

Terminal window
helm install zentri deploy/helm/zentri --namespace zentri \
--set database.existingSecret=zentri-db \
--set bootstrapAdminToken.existingSecret=zentri-app \
--set dataKey.existingSecret=zentri-app \
--set image.repository=registry.example.com/zentri-server \
--set image.tag=0.1.0 \
--wait

Keep the settings in a values file for real installs. deploy/helm/zentri/values.yaml documents every setting, and deploy/helm/zentri/ci/ has three complete examples.

The chart refuses to render, with a message, when it has no database, when it has both a database and postgresql.enabled, when a secret is given both ways, or when a setting name is misspelled.

Setting Default What it does
image.repository, image.tag, image.digest ghcr.io/zentri-repo/zentri-server, the chart’s appVersion, none The coordinator image. A digest replaces the tag.
models.embedder hash hash (offline), ollama, or openai. See Model setup.
models.embedBaseURL, models.embedModel none The embedder’s URL and model.
models.llmBaseURL, models.llmModel none An OpenAI-compatible URL ending in /v1, which turns on the LLM steps, and its model.
models.timeout the coordinator’s default Per-call model timeout, such as 5s.
otlpEndpoint none Sends traces to this OTLP endpoint.
extraEnv, extraArgs none More variables for the coordinator, and more arguments after serve --no-migrate.
service.type, service.port ClusterIP, 8080 The Service.
ingress.* off An Ingress with your class, hosts and TLS.
resources 100m CPU and 128Mi requested, 512Mi limit The coordinator’s resources. migrations.resources sets the init container’s.
networkPolicy.* off See Network policies.

The coordinator checks its model settings when it starts. A wrong combination stops it with a message in its log, and the pod restarts until you fix it.

With bootstrapAdminToken, the coordinator creates the admin user from your token and prints nothing. Keep the token in your password manager.

Without it, the coordinator makes a token on its first start and prints it once to its log:

Terminal window
kubectl -n zentri logs deploy/zentri -c coordinator | grep -A1 'bootstrap admin token'

It prints a token only on the start that creates the admin user. Read it before the pod is replaced: an upgrade or a new pod starts with an empty log, and no later start prints it again.

See The bootstrap token for how to replace it.

Terminal window
kubectl -n zentri get pods
kubectl -n zentri port-forward svc/zentri 8080:8080

In another terminal:

Terminal window
curl -fsS http://127.0.0.1:8080/readyz
{"status":"ready"}

Over the port-forward, zt login --server http://127.0.0.1:8080 works from the same machine, since zt accepts plain HTTP to loopback.

The chart probes the coordinator itself. The startup and liveness probes call /healthz, which answers while the process runs. The readiness probe calls /readyz, which also pings Postgres, so the Service sends no traffic to a coordinator that cannot reach its database. See Observability.

The migrate log ends with migrations up to date:

Terminal window
kubectl -n zentri logs deploy/zentri -c migrate

The coordinator serves plain HTTP, and zt accepts plain HTTP only for a loopback host. Engineers on other machines need HTTPS: an Ingress with TLS, a service mesh, or a private network such as Tailscale.

ingress:
enabled: true
className: nginx
hosts:
- host: zentri.example.com
paths:
- path: /
pathType: Prefix
tls:
- hosts: [zentri.example.com]
secretName: zentri-tls

Do not expose the coordinator to the public internet. See Network exposure.

networkPolicy.enabled=true adds one NetworkPolicy for each pod the chart runs:

Pod Accepts Sends to
Coordinator Port 8080, from networkPolicy.ingressFrom, or from anywhere when that is empty DNS, the evaluation Postgres and Ollama when they run, and networkPolicy.extraEgress
Evaluation Postgres Port 5432, from the coordinator only Nothing
Ollama Port 11434, from the coordinator only DNS and HTTPS, to pull models

With your own Postgres or a hosted model, add a rule for each to networkPolicy.extraEgress, or the coordinator cannot reach them:

networkPolicy:
enabled: true
ingressFrom:
- namespaceSelector:
matchLabels:
kubernetes.io/metadata.name: ingress-nginx
extraEgress:
- to:
- ipBlock:
cidr: 10.20.0.0/16
ports:
- port: 5432
protocol: TCP

Your network plugin must enforce NetworkPolicy. Without that, the objects exist and nothing is blocked.

ollama.enabled=true runs ollama/ollama:0.40.19 with its models on a 20Gi volume. With models.embedder=ollama and no models.embedBaseURL, the coordinator uses it. Pull the models into it once it runs:

Terminal window
kubectl -n zentri exec deploy/zentri-ollama -- ollama pull nomic-embed-text

Ollama runs as user 65532, so its volume must be writable by that user. The chart sets fsGroup: 65532, which most storage honors. Set ollama.threads to the performance cores the pod gets. More threads than that slow the judge past its timeout. Model sizes and timings are in Requirements and sizing.

Terminal window
helm upgrade zentri deploy/helm/zentri --namespace zentri --reuse-values \
--set image.tag=<new version> --wait

The new pod’s migrate init container applies any new migration, then the coordinator starts. Migrations only go forward, so back up first. See Upgrades and migrations.

A change to a setting or to a Secret the chart made restarts the coordinator. A change to a Secret you made does not. Restart it yourself:

Terminal window
kubectl -n zentri rollout restart deploy/zentri
Terminal window
helm uninstall zentri --namespace zentri

helm uninstall keeps the evaluation Postgres’s volume claim, data-zentri-postgresql-0. Delete it to delete the data. It does not touch your own database or the Secrets you made.

  • The chart and the image are not published. You install from a checkout and build the image yourself.
  • One coordinator per database. The chart does not scale past one replica.
  • The evaluation Postgres is for evaluation only. It has no backups and no TLS.
  • make e2e-helm installs the chart on kind with the evaluation Postgres. No managed Kubernetes, managed Postgres, Ingress controller or Ollama in a cluster has been tested.
  • The chart has no PodDisruptionBudget and no HorizontalPodAutoscaler, since it runs one replica.