k0rtexdocs Get started

Kubernetes deployment.

On this page

This guide installs the k0rtex server on Kubernetes with its Helm chart. It takes you from an empty cluster to a hosted board: people sign in, the board reaches GitHub through its GitHub App, and workers pair with it from their own machines. For a first look, the quick start runs the board on a cluster without any of that.

What the chart deploys #

The chart (charts/k0rtex, published as oci://acrplatweu01-fdeugvadguaahga0.azurecr.io/charts/k0rtex) installs these resources for a release named board:

Resource Name What it is
Deployment k0rtex-board The server: one replica, Recreate upgrades, non-root (uid 10001), HTTP on 8765 and SSH on 8766
Service k0rtex-board HTTP for the ingress. Only created when publicHost is set
Service k0rtex-board-ssh The SSH endpoint workers connect to (sshService.type)
Ingress k0rtex-board HTTPS for publicHost, when ingress.enabled
PersistentVolumeClaim k0rtex-board 5 GiB for the server’s SSH host key and saved settings
StatefulSet k0rtex-board-postgresql PostgreSQL 17, one replica, 10 GiB. Left out with postgresql.enabled=false
Secret k0rtex-board-postgresql The database password, generated once and kept across upgrades
NetworkPolicy k0rtex-board-postgresql Lets only the server reach the database

The server always runs as one replica. It takes an advisory lock on its database, so a second server would refuse to start. Workers also keep their SSH connection to one process. Recreate therefore stops the old pod before the new one starts.

The server’s container gets its settings from environment variables: the chart sets the database, the listeners and the public URL. Everything secret (sign-in, the GitHub App, administrators) comes from one Secret you create and name in existingSecret.

Prerequisites #

  • Kubernetes 1.27 or later, kubectl, and Helm 3.8 or later (for OCI charts).
  • A default StorageClass with ReadWriteOnce volumes, or the names of one or two existing claims.
  • For a hosted board:
    • An ingress controller with a TLS certificate for the board’s hostname, such as ingress-nginx with cert-manager, or a Gateway API implementation (see Gateway API).
    • A way to expose TCP for workers: a LoadBalancer Service, or a NodePort behind your own load balancer.
    • Two DNS names: one for the board (for example board.example.com) and one for workers’ SSH (for example ssh.board.example.com). They may point at different addresses.
    • A sign-in provider: an OpenID Connect issuer or a GitHub OAuth app. See Sign-in setup.
    • The board’s GitHub App, its App ID and a private key. See The GitHub App.

Quick start #

To try the board on a cluster, install the chart with its defaults and reach it through kubectl port-forward:

sh
helm upgrade --install board oci://acrplatweu01-fdeugvadguaahga0.azurecr.io/charts/k0rtex \
  --version 0.3.0 --namespace k0rtex --create-namespace --wait
kubectl -n k0rtex port-forward deployment/k0rtex-board 8765:8765 8766:8766

Open http://127.0.0.1:8765. Without publicHost the server listens only on the pod’s loopback, asks no one to sign in, and treats your browser as the board’s owner. Workers on the same machine pair with the port-forwarded SSH port.

On a local kind cluster with an image you built yourself:

sh
docker build -t k0rtex:dev .
kind load docker-image k0rtex:dev
helm upgrade --install board ./charts/k0rtex --namespace k0rtex --create-namespace \
  --set-string image.repository=k0rtex --set-string image.tag=dev --wait

A hosted board, step by step #

The examples use the release board in the namespace k0rtex, the board at board.example.com and the SSH endpoint at ssh.board.example.com.

1. Create the namespace #

sh
kubectl create namespace k0rtex

2. Create the GitHub App #

Create the board’s public GitHub App once, as The GitHub App describes, with the Setup URL https://board.example.com/settings. Note its App ID and download a private key (k0rtex.private-key.pem).

3. Create the board’s Secret #

Every key of this Secret becomes an environment variable of the server. This example signs people in with OpenID Connect:

sh
kubectl -n k0rtex create secret generic board-env \
  --from-literal=K0RTEX_ADMINS='[email protected]' \
  --from-literal=K0RTEX_OIDC_ISSUER='https://login.example.com' \
  --from-literal=K0RTEX_OIDC_CLIENT_ID='k0rtex-board' \
  --from-literal=K0RTEX_OIDC_SECRET='<client secret>' \
  --from-literal=K0RTEX_GITHUB_APP_ID='123456' \
  --from-file=K0RTEX_GITHUB_PRIVATE_KEY=k0rtex.private-key.pem \
  --from-literal=K0RTEX_SSH_PUBLIC_HOST='ssh.board.example.com'
Key Required Value
K0RTEX_ADMINS Yes, with sign-in The first administrators, comma separated. See Sign-in setup
K0RTEX_OIDC_ISSUER, K0RTEX_OIDC_CLIENT_ID, K0RTEX_OIDC_SECRET One provider An OpenID Connect sign-in. K0RTEX_OIDC_NAME labels its button
K0RTEX_OAUTH_GITHUB_CLIENT_ID, K0RTEX_OAUTH_GITHUB_SECRET One provider A GitHub OAuth app for sign-in (not the GitHub App)
K0RTEX_GITHUB_APP_ID For GitHub The GitHub App’s ID
K0RTEX_GITHUB_PRIVATE_KEY For GitHub The app’s private key. --from-file keeps the PEM as it is
K0RTEX_SSH_PUBLIC_HOST Recommended The hostname workers use for SSH, written into pairing links
K0RTEX_MCP_TOKEN No A bearer token for MCP clients outside the board
K0RTEX_QDRANT_API_KEY, K0RTEX_EMBEDDINGS_API_KEY No Keys for semantic search

The server refuses to start with only one of the GitHub App’s ID and key. Leave both out to run without GitHub. If you manage Secrets as manifests (GitOps, External Secrets), the same Secret is:

yaml
apiVersion: v1
kind: Secret
metadata:
  name: board-env
  namespace: k0rtex
type: Opaque
stringData:
  K0RTEX_ADMINS: [email protected]
  K0RTEX_OIDC_ISSUER: https://login.example.com
  K0RTEX_OIDC_CLIENT_ID: k0rtex-board
  K0RTEX_OIDC_SECRET: <client secret>
  K0RTEX_GITHUB_APP_ID: "123456"
  K0RTEX_GITHUB_PRIVATE_KEY: |
    -----BEGIN RSA PRIVATE KEY-----
    ...
    -----END RSA PRIVATE KEY-----
  K0RTEX_SSH_PUBLIC_HOST: ssh.board.example.com

4. Write the values file #

Save this as hosted.yaml:

yaml
publicHost: board.example.com
existingSecret: board-env
ingress:
  enabled: true
  className: nginx
  tlsSecretName: board-tls
  annotations:
    # The board streams live updates (server-sent events) and MCP responses.
    nginx.ingress.kubernetes.io/proxy-buffering: "off"
    nginx.ingress.kubernetes.io/proxy-read-timeout: "3600"
    # With cert-manager, let it issue board-tls:
    # cert-manager.io/cluster-issuer: letsencrypt-prod
sshService:
  type: LoadBalancer
  annotations: {}
resources:
  requests:
    cpu: 250m
    memory: 512Mi
  limits:
    memory: 2Gi

publicHost makes the server listen on all interfaces, sets its browser URL to https://<publicHost> (OAuth callbacks are built from it) and creates the HTTP Service. A board on a hostname other than loopback must use HTTPS and a sign-in provider; the server refuses to start otherwise.

5. Install #

sh
helm upgrade --install board oci://acrplatweu01-fdeugvadguaahga0.azurecr.io/charts/k0rtex \
  --version 0.3.0 --namespace k0rtex -f hosted.yaml --wait

--wait returns once the server is ready: it applied its database migrations and listens.

6. Point DNS at the cluster #

sh
kubectl -n k0rtex get ingress k0rtex-board
kubectl -n k0rtex get service k0rtex-board-ssh

Point board.example.com at the ingress address and ssh.board.example.com at the SSH Service’s EXTERNAL-IP. Workers connect only outbound, to the SSH endpoint and the board’s HTTPS URL: no port on a worker is opened.

7. Check the board #

sh
kubectl -n k0rtex get pods
kubectl -n k0rtex logs deployment/k0rtex-board

The log shows the migrations, then Uvicorn listening on port 8765. Open https://board.example.com and sign in as one of the administrators.

8. Install the GitHub App #

Settings → GitHub lists the accounts the app is installed on. Choose Install on an account or organization for each organization whose repositories the board should reach, then import repositories under Settings → Projects.

9. Pair a worker #

In Settings → Workers, choose Add worker and copy its pairing link. On the worker’s machine, install the k0rtex command (see Worker) and run:

sh
k0rtex setup

The wizard pairs with the link and starts the worker as a service. The link names the SSH host from K0RTEX_SSH_PUBLIC_HOST; without it, pass --ssh-host ssh.board.example.com when pairing.

Gateway API instead of an Ingress #

On a cluster with a Gateway API implementation, keep publicHost and turn the chart’s Ingress off (ingress.enabled: false). Route the board’s Service yourself, for example with a certificate, a listener and a route on a shared Gateway:

yaml
apiVersion: cert-manager.io/v1
kind: Certificate
metadata:
  name: board-tls
  namespace: k0rtex
spec:
  secretName: board-tls
  issuerRef: { group: cert-manager.io, kind: ClusterIssuer, name: letsencrypt-prod }
  dnsNames: [board.example.com]
---
apiVersion: gateway.networking.k8s.io/v1
kind: ListenerSet
metadata:
  name: board
  namespace: k0rtex
spec:
  parentRef: { group: gateway.networking.k8s.io, kind: Gateway, name: public, namespace: gateway }
  listeners:
    - name: https
      protocol: HTTPS
      port: 443
      hostname: board.example.com
      tls:
        mode: Terminate
        certificateRefs: [{ name: board-tls }]
      allowedRoutes:
        namespaces: { from: Same }
---
apiVersion: gateway.networking.k8s.io/v1
kind: HTTPRoute
metadata:
  name: board
  namespace: k0rtex
spec:
  parentRefs:
    - { group: gateway.networking.k8s.io, kind: ListenerSet, name: board, sectionName: https }
  hostnames: [board.example.com]
  rules:
    - backendRefs: [{ name: k0rtex-board, port: 8765 }]

If your Gateway does not support ListenerSets, add the HTTPS listener to the Gateway itself and point the HTTPRoute’s parentRefs at it. Whatever routes the board must not buffer responses: live updates and MCP stream for as long as a page or a client stays open.

Database #

The bundled PostgreSQL #

By default the chart runs PostgreSQL next to the server, generates its password and keeps it in the Secret k0rtex-board-postgresql. To supply the password yourself, create a Secret with letters and digits under password and name it:

yaml
postgresql:
  auth:
    existingSecret: board-db-password
  persistence:
    size: 20Gi
    storageClass: premium

postgresql.uid must match the image’s postgres user: 70 for the default Alpine image, 999 for the Debian images.

A managed database #

To use a managed PostgreSQL (the chart and Compose run 17; the tests also run on 16), store its URL in a Secret and turn the bundled one off:

sh
kubectl -n k0rtex create secret generic board-db \
  --from-literal=database-url='postgresql://k0rtex:<password>@db.example.com:5432/k0rtex'
yaml
postgresql:
  enabled: false
externalDatabase:
  existingSecret: board-db
  urlKey: database-url

The server creates its tables, and the knowledge index in the schema knowledge, on its first start. Its role needs to own the database (or have CREATE on it).

Backup and restore #

The board, its run history and the knowledge index are all in the database. Back it up with:

sh
kubectl -n k0rtex exec statefulset/k0rtex-board-postgresql -- \
  pg_dump -U k0rtex -Fc k0rtex > board.dump

To restore into a fresh release, stop the server, restore, and start it again:

sh
kubectl -n k0rtex scale deployment/k0rtex-board --replicas 0
kubectl -n k0rtex exec -i statefulset/k0rtex-board-postgresql -- \
  pg_restore -U k0rtex -d k0rtex --clean --if-exists < board.dump
kubectl -n k0rtex scale deployment/k0rtex-board --replicas 1

The knowledge index can also be left out and rebuilt: the board reindexes each project.

Search matches words with no further setup. To add semantic search, point the server at a Qdrant and an OpenAI-compatible embeddings endpoint; the chart runs neither:

yaml
knowledge:
  qdrantUrl: http://qdrant.qdrant:6333
  embeddings:
    url: http://ollama.ollama:11434/v1
    model: nomic-embed-text

Put K0RTEX_QDRANT_API_KEY and K0RTEX_EMBEDDINGS_API_KEY in the board’s Secret when those services need keys.

Images from a private registry #

yaml
image:
  repository: registry.example.com/platform/k0rtex
  tag: "0.3.0"
imagePullSecrets:
  - name: registry-credentials

image.tag defaults to the chart’s appVersion, the server release the chart was published with.

Upgrades and changes #

  • Upgrading with helm upgrade replaces the server pod (Recreate). Active agent runs end as interrupted; the board keeps what they committed, and you can retry them. Migrations run when the new server starts.
  • A changed Secret reaches the server only when its pod restarts: kubectl -n k0rtex rollout restart deployment/k0rtex-board.
  • Uninstalling keeps both volumes and the database password Secret, so a reinstall finds the board again. Delete them to start over: kubectl -n k0rtex delete pvc k0rtex-board data-k0rtex-board-postgresql-0 and kubectl -n k0rtex delete secret k0rtex-board-postgresql.
  • From a release before the public GitHub App: add K0RTEX_GITHUB_APP_ID and K0RTEX_GITHUB_PRIVATE_KEY to the Secret and remove K0RTEX_GITHUB_CLIENT_ID, K0RTEX_GITHUB_CLIENT_SECRET and K0RTEX_GITHUB_SLUG, which are no longer read.

Values #

Value Default Meaning
image.repository the k0rtex registry Server image
image.tag the chart’s appVersion Server version
image.pullPolicy IfNotPresent
imagePullSecrets [] Secrets for a private registry
publicHost "" The board’s HTTPS hostname. Empty: loopback only, for port-forward
existingSecret "" Secret whose keys become the server’s environment
knowledge.qdrantUrl "" Qdrant for semantic search
knowledge.embeddings.url, .model, .dimensions "" OpenAI-compatible embeddings endpoint
postgresql.enabled true Run PostgreSQL in the release
postgresql.image.repository, .tag postgres, 17-alpine Its image
postgresql.uid 70 The image’s postgres user and group
postgresql.auth.database, .username k0rtex Database and role
postgresql.auth.existingSecret, .passwordKey "", password Supply the password instead of generating it
postgresql.persistence.existingClaim, .size, .storageClass "", 10Gi, "" Database volume
postgresql.networkPolicy.enabled true Admit only the server to the database
postgresql.resources {}
externalDatabase.existingSecret, .urlKey "", database-url A managed database’s URL, when postgresql.enabled is false
persistence.existingClaim, .size, .storageClass "", 5Gi, "" The server’s volume
ingress.enabled, .className, .annotations, .tlsSecretName false, "", {}, "" HTTPS for publicHost
sshService.type, .annotations ClusterIP, {} How workers reach SSH
resources {} The server’s requests and limits

Troubleshooting #

Symptom Cause Fix
helm install fails with “Set postgresql.enabled=true, or externalDatabase.existingSecret” The bundled database is off and no URL Secret is named Set externalDatabase.existingSecret
The pod waits in wait-for-database The bundled PostgreSQL is still initializing, or its volume cannot be bound kubectl -n k0rtex describe pod -l app.kubernetes.io/name=k0rtex-postgresql
The server exits with “A hosted browser URL requires HTTPS and a sign-in provider” publicHost is set but the Secret has no sign-in provider Add the K0RTEX_OIDC_* or K0RTEX_OAUTH_GITHUB_* keys
The server exits with “Name the board’s first administrator” Sign-in is configured without K0RTEX_ADMINS Add K0RTEX_ADMINS
The server exits with “The GitHub App needs both …” Only one of the App ID and the private key is set Set both, or neither
Settings says GitHub is not configured The Secret lacks the GitHub App keys, or the pod predates them Add them and restart the deployment
Settings says the app is not installed on any account Nobody installed it yet Choose Install on an account or organization
The board stops updating until you reload The ingress buffers server-sent events Turn buffering off and raise the read timeout (see the values file)
A worker cannot connect The SSH endpoint is not reachable on port 8766 Check k0rtex-board-ssh’s address, DNS and firewalls; set K0RTEX_SSH_PUBLIC_HOST or pair with --ssh-host
The server exits with “Another k0rtex backend is using schema … of this database” Two servers share one database Run one server per database

This page is docs/kubernetes.md in the k0rtex repository. Suggest a change.