Kubernetes Setup
Deploy Brainz Lab to Kubernetes for production-grade hosting.Prerequisites
- Kubernetes 1.28+
- kubectl configured
- Helm 3.0+
- Ingress controller (nginx-ingress recommended)
- cert-manager (for SSL)
Quick Start with Helm
1. Add the Helm Repository
Copy
helm repo add brainzlab https://charts.brainzlab.ai
helm repo update
2. Create Values File
values.yaml
Copy
global:
domain: brainzlab.mycompany.com
secretKey: "your-secret-key-base"
platform:
replicas: 2
resources:
requests:
memory: "512Mi"
cpu: "250m"
recall:
replicas: 3
resources:
requests:
memory: "1Gi"
cpu: "500m"
reflex:
replicas: 2
resources:
requests:
memory: "512Mi"
cpu: "250m"
postgresql:
enabled: true
primary:
persistence:
size: 100Gi
redis:
enabled: true
replica:
replicaCount: 2
ingress:
enabled: true
className: nginx
tls:
enabled: true
issuer: letsencrypt-prod
3. Install
Copy
kubectl create namespace brainzlab
helm install brainzlab brainzlab/brainzlab \
--namespace brainzlab \
--values values.yaml
Manual Deployment
Namespace
Copy
apiVersion: v1
kind: Namespace
metadata:
name: brainzlab
Secrets
Copy
apiVersion: v1
kind: Secret
metadata:
name: brainzlab-secrets
namespace: brainzlab
type: Opaque
stringData:
secret-key-base: "your-secret-key-base"
postgres-password: "your-postgres-password"
service-token: "your-service-token"
Platform Deployment
Copy
apiVersion: apps/v1
kind: Deployment
metadata:
name: platform
namespace: brainzlab
spec:
replicas: 2
selector:
matchLabels:
app: platform
template:
metadata:
labels:
app: platform
spec:
containers:
- name: platform
image: ghcr.io/brainzlab/platform:latest
ports:
- containerPort: 3000
env:
- name: DATABASE_URL
value: postgres://postgres:$(POSTGRES_PASSWORD)@postgres:5432/platform
- name: REDIS_URL
value: redis://redis:6379/0
- name: SECRET_KEY_BASE
valueFrom:
secretKeyRef:
name: brainzlab-secrets
key: secret-key-base
resources:
requests:
memory: "512Mi"
cpu: "250m"
limits:
memory: "1Gi"
cpu: "1"
Ingress
Copy
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: brainzlab
namespace: brainzlab
annotations:
cert-manager.io/cluster-issuer: letsencrypt-prod
spec:
ingressClassName: nginx
tls:
- hosts:
- brainzlab.mycompany.com
- recall.mycompany.com
- reflex.mycompany.com
secretName: brainzlab-tls
rules:
- host: brainzlab.mycompany.com
http:
paths:
- path: /
pathType: Prefix
backend:
service:
name: platform
port:
number: 3000
- host: recall.mycompany.com
http:
paths:
- path: /
pathType: Prefix
backend:
service:
name: recall
port:
number: 3000
Scaling
Horizontal Pod Autoscaler
Copy
apiVersion: autoscaling/v2
kind: HorizontalPodAutoscaler
metadata:
name: recall
namespace: brainzlab
spec:
scaleTargetRef:
apiVersion: apps/v1
kind: Deployment
name: recall
minReplicas: 2
maxReplicas: 10
metrics:
- type: Resource
resource:
name: cpu
target:
type: Utilization
averageUtilization: 70
Monitoring
Deploy with Prometheus and Grafana:Copy
helm install prometheus prometheus-community/prometheus
helm install grafana grafana/grafana
Upgrading
Copy
helm upgrade brainzlab brainzlab/brainzlab \
--namespace brainzlab \
--values values.yaml