Deploying Spectron on Kubernetes for production workloads.
Spectron is designed for Kubernetes. The application tier stores no durable state in-process – memory lives in SurrealDB – so you can run multiple replicas behind a standard Service and scale with a HorizontalPodAutoscaler. SurrealDB is deployed separately as a StatefulSet or managed service.
Secrets
Create a Kubernetes Secret for API keys before deploying any other resources. Never embed secrets directly in manifest files.
In production, use an external secrets manager (AWS Secrets Manager, GCP Secret Manager, HashiCorp Vault) with an operator such as the External Secrets Operator to populate the Secret from your secrets store.
SurrealDB StatefulSet
Deploy SurrealDB as a StatefulSet so that storage is tied to the pod identity. Set workingDir: /data to match the volume mount and SURREAL_PATH: rocksdb://surrealdb so database files land in /data/surrealdb on the persistent volume. RocksDB creates a directory there — not a single database file.
If SurrealDB fails with Failed to create RocksDB directory or a read-only filesystem error, check that workingDir matches mountPath and that the path slashes are correct — see Docker storage paths.
Spectron Deployment
Spectron uses a Deployment with RollingUpdate because replicas do not hold durable state locally.
Update the image tag in your Deployment manifest and apply it. The rolling update strategy ensures zero-downtime upgrades. Schema migrations run automatically when each new pod starts.
# Update the image tag (replace 0.2.0 with the target version) kubectl set image deployment/spectron spectron=ghcr.io/surrealdb/spectron:0.2.0 -n spectron kubectl rollout status deployment/spectron -n spectron