Skip to content

Deploy with Kubernetes

The Helm chart in deploy/k8s deploys:

  • extralit server: web UI and API on port 6900
  • extralit-worker: RQ workers for background jobs. Every worker pod pulls from the same Redis queues, so raising worker.replicaCount spreads jobs across pods
  • PostgreSQL: main database (in-chart StatefulSet, or external)
  • Redis: job queue, persisted with AOF (in-chart Deployment, or external)
  • Elasticsearch: search engine for records (managed by the ECK operator, or external)

Uploaded files and LanceDB indexes live under EXTRALIT_HOME_PATH on a PersistentVolumeClaim shared by the server and worker, unless you point storage.url at S3-compatible storage.

Prerequisites

  • Kubernetes 1.23+ with a default StorageClass
  • kubectl and Helm 3.8+
  • The ECK operator, unless you use an external Elasticsearch

For a local cluster, kind or minikube both work; give it at least 4 GB of memory.

Install

  1. Install the ECK operator:

    helm repo add elastic https://helm.elastic.co
    helm install elastic-operator elastic/eck-operator -n elastic-system --create-namespace
    
  2. Clone the repository and install the chart:

    git clone https://github.com/extralit/extralit.git
    cd extralit
    helm install extralit deploy/k8s -n extralit --create-namespace
    

    The owner password, API key and PostgreSQL password are generated unless you set extralit.auth.password, extralit.auth.apiKey and postgresql.auth.password. Set all three when rendering without cluster access (helm template, Argo CD, Flux): the chart can't read back the previous values there, so it would generate new ones on every sync and the server would lose access to PostgreSQL.

  3. Wait for the pods to become ready. The server pod runs database migrations and creates the owner user on startup, so it takes a minute or two:

    kubectl -n extralit get pods -w
    
  4. Open Extralit:

    kubectl -n extralit port-forward svc/extralit 6900
    

    Then go to http://localhost:6900 and log in as extralit. Get the password with:

    kubectl -n extralit get secret extralit-secrets -o jsonpath='{.data.password}' | base64 -d
    
  5. Optionally, check the release with the bundled Helm test:

    helm test extralit -n extralit
    

Limitations

  • Text extraction jobs fail. The ocr queue's text-extraction job imports extralit_ocr, which is installed in the HF Space image but not in extralit-server. Layout extraction and the other ocr jobs run.
  • Redis is a single pod. It keeps queued jobs across restarts but has no failover; use externalRedis with a managed Redis for high availability.
  • Workers share one node by default. With a ReadWriteOnce volume and file storage, every worker runs on the server's node. To spread workers across nodes, use S3 storage (storage.url) and extralit.persistence.accessMode=ReadWriteMany.

Configuration

Set values with --set or a values file (helm install ... -f my-values.yaml). See values.yaml for all options.

Value Default Notes
extralit.image.repository / tag extralit/extralit-server / chart appVersion Use extralitdev/extralit-server for builds from main
extralit.auth.username / password / apiKey / workspace extralit / generated / generated / default Owner user created on first install only
extralit.authSecretKey generated Kept across upgrades
extralit.baseUrl "" Serve under a path prefix, e.g. /extralit
extralit.persistence.* 2Gi ReadWriteOnce at /var/lib/extralit With ReadWriteOnce the worker runs on the server's node and rollouts use Recreate; use ReadWriteMany to spread pods
extralit.ingress.* disabled className, host, annotations, tls
extralit.hpa.* disabled Needs ReadWriteMany persistence; the chart refuses to render it with ReadWriteOnce
nodeSelector, tolerations none Applied to server and worker pods
worker.replicaCount / numWorkers / queues 1 / 2 / [high, default, ocr] Pods × processes per pod; queues in priority order
extralit.extraEnv [] Any other EXTRALIT_* server setting
storage.url, storage.s3.* files on the PVC s3://bucket[/prefix], or http(s)://host[:port]/bucket for MinIO and R2
postgresql.enabled / externalDatabase.url true / "" External format: postgresql+asyncpg://user:pass@host:5432/db
elasticsearch.useOperator / externalElasticsearch.url true / "" External format: http://user:pass@host:9200
redis.enabled / externalRedis.url true / redis://localhost:6379/0 redis.persistence.* keeps queued jobs across restarts

Ingress

To expose Extralit through an ingress controller, e.g. on minikube:

minikube addons enable ingress
helm upgrade extralit deploy/k8s -n extralit --reuse-values \
  --set extralit.ingress.enabled=true \
  --set extralit.ingress.host=extralit.local
echo "$(minikube ip) extralit.local" | sudo tee -a /etc/hosts

External services

To use managed services instead of the in-chart ones:

postgresql:
  enabled: false
externalDatabase:
  url: postgresql+asyncpg://extralit:<password>@db.example.com:5432/extralit

elasticsearch:
  useOperator: false
externalElasticsearch:
  url: https://elastic:<password>@es.example.com:9200

redis:
  enabled: false
externalRedis:
  url: redis://redis.example.com:6379/0

storage:
  url: s3://my-bucket/extralit
  s3:
    accessKey: <access-key>
    secretKey: <secret-key>
    region: us-east-1

Upgrade and uninstall

helm upgrade extralit deploy/k8s -n extralit --reuse-values
helm uninstall extralit -n extralit

helm uninstall keeps the PostgreSQL and Elasticsearch PVCs. Delete them with kubectl -n extralit delete pvc -l app.kubernetes.io/instance=extralit and kubectl -n extralit delete pvc -l elasticsearch.k8s.elastic.co/cluster-name=extralit if you no longer need the data.

Troubleshooting

  • Server pod restarts during startup: check kubectl -n extralit logs deploy/extralit. Migrations and user creation need PostgreSQL and Elasticsearch to be ready; the server retries until its startup probe gives up after 10 minutes.
  • Pods stuck in Pending: usually a PVC that can't bind. Check kubectl -n extralit get pvc and set the *.persistence.storageClass values if the cluster has no default StorageClass. With a ReadWriteOnce volume the worker is placed on the server's node, so it stays Pending until the server is scheduled.
  • Elasticsearch never becomes healthy: check kubectl -n extralit get elasticsearch and the operator logs with kubectl -n elastic-system logs statefulset/elastic-operator. A single-node cluster needs about 2 GB of memory.
  • Search index lost: records are stored in PostgreSQL, so you can rebuild the index with kubectl -n extralit exec deploy/extralit -- python -m extralit_server search-engine reindex.
  • Changed extralit.auth.* after install: the owner user is only created on first install, so changing these values afterwards updates the Secret but not the user's real credentials.
  • Changed postgresql.auth.password after install: PostgreSQL only reads it when initializing an empty volume. Change the password inside the database as well, or delete the PostgreSQL PVC to start over.

For support, join the Extralit Slack channel.