> For the complete documentation index, see [llms.txt](https://docs.visdom.virtuslab.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.visdom.virtuslab.com/visdom-ai-gateway/operations/kubernetes-helm.md). Agents can also search and read this documentation through its [MCP server](https://docs.visdom.virtuslab.com/~gitbook/mcp).

# Install on Kubernetes (Helm)

Install the LLM gateway, the MCP gateway and the console on your own Kubernetes cluster with one Helm chart: values, secrets, network policies, pod security, upgrades.

One Helm chart, `visdom-ai-gateway`, installs the whole product into one namespace: the LLM gateway (LiteLLM), the MCP gateway (IBM MCP Context Forge), the console and, for evaluation, a bundled PostgreSQL and Redis. It is the same set of components and settings as the Docker Compose deployment.

## Requirements

| Requirement        | Detail                                                                                                                                                                  |
| ------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Kubernetes         | 1.30 or newer (`kubeVersion: ">=1.30.0-0"` in the chart). CI installs the chart on kind with Kubernetes 1.30.                                                           |
| Helm               | Helm 3 with OCI registry support.                                                                                                                                       |
| CNI                | One that enforces NetworkPolicy (Calico, Cilium). The chart's network policies are on by default.                                                                       |
| Ingress controller | Optional but usual. The default network policy admits traffic from the namespace `ingress-nginx`; change `networkPolicy.ingressFrom` if your controller runs elsewhere. |
| Storage            | A `ReadWriteOnce` volume of 1 Gi for the console. With the bundled PostgreSQL, another 8 Gi.                                                                            |
| PostgreSQL         | Bundled (one pod, evaluation only) or your own: PostgreSQL with two databases, `litellm` and `contextforge`, owned by one user.                                         |
| Redis              | Bundled (one pod, no persistence) or your own Redis or Valkey, with or without TLS and a password.                                                                      |

## What the chart deploys

| Resource                                     | What it is                                                                                                                                                                                 |
| -------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `Deployment` llm-gateway                     | LiteLLM, 2 replicas, spread across zones and nodes. Stateless: keys, projects and spend in PostgreSQL; rate-limit and budget counters in Redis, so every replica enforces the same limits. |
| `Deployment` mcp-gateway                     | Context Forge, 2 replicas, spread across zones and nodes. Stateless: registry in PostgreSQL; cache (disabled tools, revoked tokens) in Redis. `mcpGateway.enabled: false` leaves it out.   |
| `Deployment` console                         | 1 replica, strategy `Recreate`, with a 1 Gi PVC for the evidence chain, approvals, alert history and notification settings.                                                                |
| `Service` × 3                                | ClusterIP: console 3000, llm-gateway 4000, mcp-gateway 4444.                                                                                                                               |
| `PodDisruptionBudget` × 2 (× 3 with OPA)     | Both gateways and OPA, `minAvailable: 1`.                                                                                                                                                  |
| `ConfigMap`s                                 | LiteLLM's `config.yaml` with the guardrails; the detectors shared by both gateways; the MCP gateway's plugins; the bank's guardrail rules (`bankRules`); the CA bundle when given inline.  |
| `Secret`                                     | Every credential, unless you bring your own (`secrets.existingSecret`). Kept on uninstall.                                                                                                 |
| `NetworkPolicy`                              | Default-deny for every pod of the release, then only the expected paths.                                                                                                                   |
| `Ingress`                                    | Optional; one host per component.                                                                                                                                                          |
| `StatefulSet` postgresql, `Deployment` redis | Optional, on by default; for evaluation, not highly available.                                                                                                                             |
| `Deployment` opa                             | Optional (`mcpGateway.plugins.opa.enabled`), 2 replicas: the OPA server the MCP gateway asks before every tool call.                                                                       |

## Get the chart

Each chart version is published once to Visdom's OCI registry, signed with cosign (keyless), and tagged `chart-v<version>` in Git. The chart version and the console version move independently: you pick a chart version and set the console release with `console.image.tag`.

The registry is private. Log in with the credentials you received for it, verify the signature, then pull or install:

```bash
CHART=oci://europe-west4-docker.pkg.dev/visdom-496808/visdom-gar/charts/visdom-ai-gateway
CHART_VERSION=0.7.0

cosign verify europe-west4-docker.pkg.dev/visdom-496808/visdom-gar/charts/visdom-ai-gateway:$CHART_VERSION \
  --certificate-identity https://github.com/VirtusLab/visdom-ai-gateway/.github/workflows/cicd.yml@refs/heads/main \
  --certificate-oidc-issuer https://token.actions.githubusercontent.com

helm pull $CHART --version $CHART_VERSION
```

For an air-gapped site, push the pulled package into your internal registry and install from there:

```bash
helm push visdom-ai-gateway-$CHART_VERSION.tgz oci://registry.internal/charts
```

The console image is released separately; its digest is in the GitHub Release notes of each `v<version>`. See [Releases and upgrades](https://docs.visdom.virtuslab.com/visdom-ai-gateway/operations/upgrades-and-releases.md) and, for mirroring every image, [Offline and air-gapped](https://docs.visdom.virtuslab.com/visdom-ai-gateway/operations/offline-and-air-gapped.md).

## Credentials

### The release's Secret

One Secret holds every credential of the release. Without `secrets.existingSecret`, the chart creates it on first install with random values and keeps them across upgrades; `secrets.values.<key>` fixes one value. With `secrets.existingSecret` (Vault, External Secrets, Sealed Secrets) the Secret must hold:

| Key                            | Used by                           | Notes                                                                                                            |
| ------------------------------ | --------------------------------- | ---------------------------------------------------------------------------------------------------------------- |
| `postgres-password`            | both gateways, bundled PostgreSQL | Placed in a connection URL: keep it URL-safe.                                                                    |
| `redis-password`               | both gateways                     | May be empty for a Redis without AUTH.                                                                           |
| `litellm-master-key`           | LLM gateway, console              | Starts with `sk-`.                                                                                               |
| `litellm-salt-key`             | LLM gateway                       | Starts with `sk-`. Encrypts provider credentials stored in the database: never change it once models are stored. |
| `mcp-jwt-secret-key`           | MCP gateway                       | Signs client tokens.                                                                                             |
| `mcp-auth-encryption-secret`   | MCP gateway                       | Encrypts tool servers' credentials at rest.                                                                      |
| `mcp-admin-password`           | MCP gateway, console              | 12 characters or more, with upper and lower case, a digit and a symbol.                                          |
| `mcp-default-user-password`    | MCP gateway                       | Same rules.                                                                                                      |
| `console-admin-password`       | console                           | The local admin account (local sign-in mode).                                                                    |
| `console-session-secret`       | console                           | Signs session cookies.                                                                                           |
| `console-hook-secret`          | LLM gateway, console              | Authenticates the LLM gateway's budget alerts and call context to the console.                                   |
| `console-reporting-token`      | console                           | Optional: the read-only reporting token. Absent: reporting API off.                                              |
| `records-otlp-headers`         | console                           | Optional: headers for the SIEM collector, `name=value,name=value`.                                               |
| `smtp-password`                | console                           | Optional: the SMTP relay's password.                                                                             |
| `ai-gateway-m2m-client-secret` | console                           | Optional: the Keycloak client `ai-gateway-m2m`, for Control Plane and AI Tracing.                                |

The optional keys are never generated. Set them in `secrets.values` or in your own Secret.

{% hint style="warning" %}
The chart keeps generated values across upgrades by reading the existing Secret from the cluster (Helm's `lookup`). Tools that render the chart without a cluster connection (`helm template`, many GitOps setups) cannot read it and would generate new values on every render. In that case, create the Secret yourself and set `secrets.existingSecret`.
{% endhint %}

### Provider credentials

Model provider credentials stay out of the release's Secret. Create one or more Secrets whose keys become environment variables of the LLM gateway, and list them in `providerSecrets`. Only the providers you use:

```bash
kubectl create namespace ai-gateway
kubectl -n ai-gateway create secret generic visdom-ai-gateway-providers \
  --from-literal=ANTHROPIC_API_KEY=sk-... \
  --from-literal=AZURE_API_KEY=... --from-literal=AZURE_API_BASE=https://bank-openai.openai.azure.com \
  --from-file=VERTEX_CREDENTIALS=vertex-sa.json
```

For Azure OpenAI with Entra ID instead of an API key, set `AZURE_TENANT_ID`, `AZURE_CLIENT_ID` and `AZURE_CLIENT_SECRET` (with `AZURE_API_BASE`, and no `AZURE_API_KEY`). See [Model catalogue and providers](https://docs.visdom.virtuslab.com/visdom-ai-gateway/llm-gateway/model-catalogue.md).

## Values

Start from `values.yaml` in the chart; `values-external.yaml` is a complete production-style example with external PostgreSQL and Redis, a proxy and a CA bundle. A realistic `my-values.yaml` for a site inside the Visdom platform:

```yaml
secrets:
  existingSecret: visdom-ai-gateway          # created out of band, keys in the table above
providerSecrets:
  - visdom-ai-gateway-providers

imagePullSecrets:
  - name: visdom-registry                    # docker-registry Secret for the private console image

console:
  image:
    tag: v0.3.3                              # required: the console release you install
  publicUrl: https://ai-gateway.example.com
  auth:
    mode: keycloak                           # people sign in with the Visdom account
    issuerUrl: https://auth.example.com/realms/visdom
  platformMode: integrated                   # projects from Control Plane, records to AI Tracing
  platform:
    controlPlaneUrl: http://control-plane.visdom.svc:8080
  extraEnv:
    - name: VISDOM_AI_TRACING_URL
      value: http://ai-tracing.visdom.svc:3000
  gatewayInstance: ai-gateway.prod           # this gateway's stable name in AI Tracing
  captureContent: false                      # true: masked prompts and answers to AI Tracing
  records:
    otlpEndpoint: http://otel-collector.observability.svc:4318   # SIEM export
  smtp:
    host: smtp-relay.bank.example
    port: 587
    security: starttls
    from: "Visdom AI Gateway <ai-gateway@bank.example>"
  notificationsLanguage: en

mcpGateway:
  allowedNetworks:
    - 10.20.0.0/16                           # where approved MCP tool servers run

postgresql:
  enabled: false
externalDatabase:
  host: pg-ai-gateway.bank.example
  port: 5432
  user: gateway
  sslmode: require
redis:
  enabled: false
externalRedis:
  host: redis-ai-gateway.bank.example
  port: 6379
  tls: true

ingress:
  enabled: true
  className: nginx
  annotations:
    nginx.ingress.kubernetes.io/proxy-buffering: "off"   # MCP streaming
  hosts:
    console: ai-gateway.example.com
    llmGateway: llm.ai-gateway.example.com
    mcpGateway: mcp.ai-gateway.example.com
  tls:
    - secretName: ai-gateway-tls
      hosts: [ai-gateway.example.com, llm.ai-gateway.example.com, mcp.ai-gateway.example.com]

networkPolicy:
  console:
    ingressFrom:                             # Control Plane's project sync calls the console
      - namespaceSelector: { matchLabels: { kubernetes.io/metadata.name: visdom } }
    egress:                                  # Keycloak, Control Plane, AI Tracing, collector, SMTP relay
      - to:
          - namespaceSelector: { matchLabels: { kubernetes.io/metadata.name: visdom } }
          - namespaceSelector: { matchLabels: { kubernetes.io/metadata.name: observability } }
      - to:
          - ipBlock: { cidr: 10.40.0.25/32 }  # the SMTP relay
        ports:
          - { port: 587, protocol: TCP }
  externalDatabaseTo:
    - ipBlock: { cidr: 10.30.0.0/24 }
  externalRedisTo:
    - ipBlock: { cidr: 10.30.1.0/24 }
```

Notes on these values:

* `console.image.tag` (or `console.image.digest`) is required. The chart has no default for it and stops with a message without it. The console image comes from Visdom's private registry, hence `imagePullSecrets`; for images mirrored into your own registry, see [Offline and air-gapped](https://docs.visdom.virtuslab.com/visdom-ai-gateway/operations/offline-and-air-gapped.md).
* `console.publicUrl`, `console.llmPublicUrl` and `console.mcpPublicUrl` default to the ingress hosts. The console shows the gateway addresses next to a new API key and in the MCP client snippets, and marks its session cookie `Secure` when its ingress host has TLS.
* With `console.auth.mode: keycloak`, `console.auth.issuerUrl` is required, and the realm needs the public client `visdom-ai-gateway` with the redirect URI `{publicUrl}/api/session/callback`. See [Sign-in and roles](https://docs.visdom.virtuslab.com/visdom-ai-gateway/visdom-platform/sign-in-and-roles.md).
* `console.platformMode` sets all three platform connections at once. To switch them one at a time, set `PLATFORM_PROJECTS_MODE`, `PLATFORM_ACCESS_MODE` and `PLATFORM_EVIDENCE_MODE` in `console.extraEnv`. Integrated modes need the secret key `ai-gateway-m2m-client-secret`. See [The gateway in the Visdom platform](https://docs.visdom.virtuslab.com/visdom-ai-gateway/visdom-platform/platform.md).
* The chart has no dedicated value for the AI Tracing address; set `VISDOM_AI_TRACING_URL` in `console.extraEnv`, as above.
* `console.captureContent: true` needs the AI Tracing ingest, which is on when evidence is integrated.
* The MCP gateway reaches only private networks listed in `mcpGateway.allowedNetworks`. Empty (the default), it can register no tool server on a private address. Include the pod network for tool servers inside the cluster.
* For an external PostgreSQL, create both databases first:

  ```sql
  CREATE DATABASE litellm OWNER gateway;
  CREATE DATABASE contextforge OWNER gateway;
  ```

Every value and the environment variable it sets: [Configuration reference](https://docs.visdom.virtuslab.com/visdom-ai-gateway/operations/configuration-reference.md).

## Install

{% tabs %}
{% tab title="Evaluation" %}
Bundled PostgreSQL and Redis, credentials generated by the chart:

```bash
helm install ai-gateway $CHART --version $CHART_VERSION -n ai-gateway \
  --set console.image.tag=v0.3.3 \
  --set 'providerSecrets={visdom-ai-gateway-providers}'
```

Read the generated admin password and open the console:

```bash
kubectl -n ai-gateway get secret ai-gateway-visdom-ai-gateway \
  -o jsonpath='{.data.console-admin-password}' | base64 -d
kubectl -n ai-gateway port-forward svc/ai-gateway-visdom-ai-gateway-console 3000:3000
```

Sign in at `http://localhost:3000` as `admin@example.com` (`console.adminEmail`).
{% endtab %}

{% tab title="Production" %}
Your own PostgreSQL, Redis, Secret, ingress, proxy and CA bundle:

```bash
helm install ai-gateway $CHART --version $CHART_VERSION -n ai-gateway -f my-values.yaml
```

{% endtab %}
{% endtabs %}

The first install runs the database migrations of both gateways; the startup probes allow five minutes for it.

## Network policies

`networkPolicy.enabled` (default `true`) puts every pod of the release behind a default-deny policy, DNS allowed, and then opens only these paths:

| Pod               | Accepts from                                                                                                                    | May call                                                                                                 |
| ----------------- | ------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------- |
| console           | ingress controller (`networkPolicy.ingressFrom`), the LLM gateway, Visdom modules listed in `networkPolicy.console.ingressFrom` | both gateways; `networkPolicy.console.egress`                                                            |
| llm-gateway       | ingress controller, `networkPolicy.clientsFrom`, console                                                                        | PostgreSQL, Redis, console; `networkPolicy.llmGateway.egress`, by default **TCP 443 to any address**     |
| mcp-gateway       | ingress controller, `networkPolicy.clientsFrom`, console                                                                        | PostgreSQL, Redis, OPA when on; **only** `mcpGateway.allowedNetworks`; `networkPolicy.mcpGateway.egress` |
| postgresql, redis | the two gateways                                                                                                                | nothing                                                                                                  |
| opa               | the MCP gateway                                                                                                                 | nothing                                                                                                  |

So the only traffic that leaves the cluster is the LLM gateway's calls to model providers and, if you allow networks, the MCP gateway's calls to approved tool servers. The console has no egress beyond the two gateways until you add it: Keycloak, Control Plane, AI Tracing, the SIEM collector, the SMTP relay and the chat webhook each need a rule in `networkPolicy.console.egress`.

Behind a corporate proxy, narrow `networkPolicy.llmGateway.egress` to the proxy. To make the gateway the only path to models for other namespaces too, use `networkPolicy.clientEgress`. Both are in [Network, proxy and egress](https://docs.visdom.virtuslab.com/visdom-ai-gateway/operations/network-proxy-and-egress.md).

## Pod security

Every pod runs as a non-root user, with `allowPrivilegeEscalation: false`, all capabilities dropped, the `RuntimeDefault` seccomp profile and a read-only root filesystem. The paths an image writes are volumes. The release passes the Pod Security Standard `restricted`: the CI test installs it into a namespace labelled `pod-security.kubernetes.io/enforce=restricted`.

| Pod         | UID   | Writable paths                                     |
| ----------- | ----- | -------------------------------------------------- |
| llm-gateway | 65532 | `/tmp`, `/var/lib/litellm` (emptyDir)              |
| mcp-gateway | 10001 | `/tmp` (emptyDir)                                  |
| console     | 1000  | `/data` (PVC), `/tmp` (emptyDir)                   |
| postgresql  | 70    | data PVC, `/var/run/postgresql`, `/tmp` (emptyDir) |
| redis       | 999   | `/data` (emptyDir)                                 |
| opa         | 1000  | nothing                                            |

No image needs its UID to own a file, so any UID works.

### OpenShift

Set `openshift: true`. The chart then leaves `runAsUser`, `runAsGroup` and `fsGroup` out of every pod, and the `restricted-v2` SCC assigns them from the namespace's range.

{% hint style="info" %}
CI tests the chart on kind. A run on OpenShift, RKE2 or a managed cloud (AKS, EKS) is not part of CI yet.
{% endhint %}

## Replicas and availability

| Component                   | Default                                  | Notes                                                                                                                                                      |
| --------------------------- | ---------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------- |
| LLM gateway                 | `llmGateway.replicaCount: 2`             | PDB `minAvailable: 1`; replicas spread across zones and nodes (below).                                                                                     |
| MCP gateway                 | `mcpGateway.replicaCount: 2`             | Same. `mcpGateway.workers` (default 2) sets Gunicorn workers per pod.                                                                                      |
| OPA                         | `mcpGateway.plugins.opa.replicaCount: 2` | PDB `minAvailable: 1` (`mcpGateway.plugins.opa.podDisruptionBudget`), spread like the gateways. With OPA unreachable, every tool call is refused.          |
| Console                     | 1, not configurable                      | Keeps its state on a `ReadWriteOnce` volume, so it is replaced with `Recreate`. While it restarts, the console is unavailable; both gateways keep serving. |
| PostgreSQL, Redis (bundled) | 1                                        | Not highly available. Use your own services for production.                                                                                                |

The replicas of the LLM gateway, the MCP gateway and OPA are spread across zones and nodes, on top of a preferred anti-affinity per node:

```yaml
topologySpread:
  enabled: true                            # false: no spread constraints
  topologyKeys:
    - topology.kubernetes.io/zone
    - kubernetes.io/hostname
  maxSkew: 1
  whenUnsatisfiable: ScheduleAnyway        # DoNotSchedule: a hard rule
```

`ScheduleAnyway` is a preference, so a cluster with one zone or one node still schedules every replica. Set `DoNotSchedule` where the cluster has enough zones and nodes for a hard rule. A component's own `topologySpreadConstraints` (`llmGateway`, `mcpGateway`, `mcpGateway.plugins.opa`) replace the default for that component.

## Upgrade and roll back

```bash
helm upgrade ai-gateway $CHART --version <new chart version> -n ai-gateway -f my-values.yaml \
  --set console.image.tag=<new console release>
kubectl -n ai-gateway get pods -w
helm -n ai-gateway history ai-gateway
helm -n ai-gateway rollback ai-gateway <revision>
```

{% hint style="warning" %}
`helm rollback` restores the Kubernetes objects, not the databases. A new chart version can bring a new LiteLLM or Context Forge version that migrates its database on start. Back up both PostgreSQL databases before such an upgrade.
{% endhint %}

What a new chart version means and what is kept across upgrades: [Releases and upgrades](https://docs.visdom.virtuslab.com/visdom-ai-gateway/operations/upgrades-and-releases.md).

## Checks after install

1. Every pod is ready:

   ```bash
   kubectl -n ai-gateway get pods
   ```
2. The console answers and reports both gateways up. Sign in and open **Dashboard**: the LLM gateway and MCP gateway tiles show **UP**. Without a browser:

   ```bash
   curl -s https://ai-gateway.example.com/healthz        # {"status":"ok","commit":"…","commitDate":"…"}
   ```
3. The LLM gateway is live through the ingress:

   ```bash
   curl -s -o /dev/null -w '%{http_code}\n' https://llm.ai-gateway.example.com/health/liveliness   # 200
   ```
4. A model call works end to end: set a budget and an allow-list for a project in **Budgets**, issue a key in **API keys**, then call `GET https://llm.ai-gateway.example.com/v1/models` and `POST /v1/chat/completions` with it. See [Calling models](https://docs.visdom.virtuslab.com/visdom-ai-gateway/llm-gateway/calling-models.md).
5. An MCP tool call works: register a tool server, create a virtual server, issue a client token and connect a client. See [Virtual servers and client tokens](https://docs.visdom.virtuslab.com/visdom-ai-gateway/mcp-gateway/virtual-servers.md).
6. The network policies hold: from a pod in another namespace, the gateways are not reachable unless that namespace is in `networkPolicy.clientsFrom` or `networkPolicy.clientEgress.namespaces`. The checks for direct provider access are in [Network, proxy and egress](https://docs.visdom.virtuslab.com/visdom-ai-gateway/operations/network-proxy-and-egress.md).

The repository's `scripts/helm-kind-test.sh` runs these checks, and more, against the current Kubernetes context; CI runs it on every chart change.
