Skip to content

Kubernetes Deployment

Deploy Torale to production Kubernetes environments.

Prerequisites

  • Kubernetes cluster
  • PostgreSQL database (managed or self-hosted)
  • Temporal Cloud account or self-hosted Temporal
  • DNS configuration for domains

GKE Quick Start

bash
# One-time cluster setup
just k8s-setup

# Deploy all services
just k8s-deploy-all

# Verify deployment
just k8s-status

Helm Configuration

Main configuration in helm/torale/values.yaml:

yaml
domains:
  frontend: torale.ai
  api: api.torale.ai
  docs: docs.torale.ai

api:
  replicaCount: 2
  autoscaling:
    minReplicas: 2
    maxReplicas: 10

Override for production in values-production.yaml.

Deployment Components

API Deployment - FastAPI with Cloud SQL Proxy sidecar, HPA for scaling

Worker Deployment - Temporal workers with Cloud SQL Proxy, HPA for scaling

Frontend & Docs - nginx serving static assets, lightweight HPA

Ingress - GCE Load Balancer with automatic SSL via Managed Certificates

Migration Job - Helm pre-install/pre-upgrade hook runs Alembic migrations

Deploy

bash
IMAGE_TAG=latest helmfile sync --selector tier=app

Verify rollout:

bash
kubectl rollout status deployment/torale-api -n torale
kubectl rollout status deployment/torale-worker -n torale
kubectl rollout status deployment/torale-frontend -n torale
kubectl rollout status deployment/torale-docs -n torale

Secrets Management

Create secrets manually before deployment:

bash
kubectl create secret generic torale-secrets -n torale \
  --from-literal=GOOGLE_API_KEY="..." \
  --from-literal=CLERK_SECRET_KEY="..." \
  --from-literal=DB_PASSWORD="..." \
  --from-literal=TEMPORAL_API_KEY="..."

Or use the helper script:

bash
just k8s-create-secrets

Cost Optimization

All services use Spot VMs:

  • 60-91% cost savings
  • Automatic pod migration on preemption
  • nodeSelector and tolerations configured in Helm

Resource requests are right-sized:

  • API/Workers: 100m CPU, 256Mi RAM
  • Frontend/Docs: 50m CPU, 64Mi RAM

Next Steps

Released under the MIT License.