Skip to content

Kubernetes (Helm)

contextdb ships a Helm chart for Kubernetes deployment.

Install

bash
helm install contextdb deploy/helm/contextdb

Default configuration

The chart deploys contextdb in embedded mode with BadgerDB persistence:

yaml
# values.yaml defaults
replicaCount: 1

image:
  repository: ghcr.io/antiartificial/contextdb
  tag: "latest"
  pullPolicy: IfNotPresent

service:
  type: ClusterIP
  grpcPort: 7700
  restPort: 7701
  observePort: 7702

resources:
  requests:
    cpu: 100m
    memory: 128Mi
  limits:
    cpu: 500m
    memory: 512Mi

config:
  mode: "embedded"
  dataDir: "/data"
  logLevel: "info"

persistence:
  enabled: true
  size: 1Gi
  storageClass: ""

With Postgres

yaml
# values-postgres.yaml
config:
  mode: "standard"

postgres:
  enabled: true
  dsn: "postgres://user:pass@postgres-host:5432/contextdb?sslmode=require"

persistence:
  enabled: false  # not needed with Postgres
bash
helm install contextdb deploy/helm/contextdb -f values-postgres.yaml

Autoscaling

yaml
autoscaling:
  enabled: true
  minReplicas: 1
  maxReplicas: 3
  targetCPUUtilization: 80

When autoscaling is enabled, the chart creates a HorizontalPodAutoscaler. Note that only Postgres mode supports multiple replicas. Embedded mode uses local storage.

Ingress

yaml
ingress:
  enabled: true
  className: "nginx"
  annotations:
    nginx.ingress.kubernetes.io/backend-protocol: "GRPC"
  hosts:
    - host: contextdb.example.com
      paths:
        - path: /
          pathType: Prefix
  tls:
    - secretName: contextdb-tls
      hosts:
        - contextdb.example.com

Exposed ports

PortProtocolService name
7700gRPCcontextdb-grpc
7701HTTPcontextdb-rest
7702HTTPcontextdb-observe

Template rendering

Preview the generated manifests:

bash
helm template contextdb deploy/helm/contextdb

Lint

bash
helm lint deploy/helm/contextdb

values.yaml reference

KeyTypeDefaultDescription
replicaCountint1Number of replicas
image.repositorystringghcr.io/antiartificial/contextdbContainer image
image.tagstringlatestImage tag
image.pullPolicystringIfNotPresentPull policy
service.typestringClusterIPService type
service.grpcPortint7700gRPC port
service.restPortint7701REST port
service.observePortint7702Observe port
resources.requests.cpustring100mCPU request
resources.requests.memorystring128MiMemory request
resources.limits.cpustring500mCPU limit
resources.limits.memorystring512MiMemory limit
config.modestringembeddedStorage mode
config.dataDirstring/dataBadgerDB directory
config.logLevelstringinfoLog level
persistence.enabledbooltrueEnable PVC
persistence.sizestring1GiPVC size
persistence.storageClassstring""Storage class
postgres.enabledboolfalseEnable Postgres
postgres.dsnstring""Postgres DSN
autoscaling.enabledboolfalseEnable HPA
autoscaling.minReplicasint1Min replicas
autoscaling.maxReplicasint3Max replicas
autoscaling.targetCPUUtilizationint80CPU target %
ingress.enabledboolfalseEnable Ingress

Released under the MIT License.