provisioning
provisioningdev

K8s Provisioning

Built with Go + native client-go. No kubectl shell-outs. PostgreSQL fully functional. MySQL and MongoDB provisioners in progress.

Orchestrates best-of-breed Kubernetes operators to provide a unified REST API for multi-database provisioning, backup/restore, and lifecycle management.

Status

DatabaseStatusOperator
PostgreSQLFully functionalCloudNativePG
MySQLIn progressVitess
MongoDBIn progressMongoDB Community Operator

What It Does

Instead of manually applying Kubernetes CRDs, you call a single REST endpoint. The provisioner handles:

  • Namespace creation and isolation per tenant/project
  • CRD deployment via native client-go dynamic client (no kubectl)
  • Credential generation with AES-256-GCM encryption
  • Continuous WAL archiving and backup scheduling
  • Point-in-time recovery (PITR)
  • Per-pod CPU/memory monitoring via Kubernetes metrics-server
  • pg_stat_statements performance insights

Architecture

┌────────────────────────────────────────┐
│  Go Server (27MB binary, <1s startup)  │
├────────────────────────────────────────┤
│  chi router → Handler → Service        │
│  ↓                                     │
│  Provisioner (Strategy pattern)        │
│  ↓                                     │
│  client-go (dynamic + typed clients)   │
│  ↓                                     │
│  K8s API → CloudNativePG Operator      │
└────────────────────────────────────────┘
  • No kubectl process spawning — all K8s operations use client-go natively
  • No Fabric8/JVM — 27MB static Go binary vs 200MB+ JVM
  • 85%+ test coverage — unit tests with mock K8s client + k3s integration tests

8-Stage Provisioning Pipeline

Each stage is tracked independently and reported via the API.

PostgreSQL provisioning pipeline

Validatingcheck name + orgNamespacek8s namespaceCRD DeployCloudNativePG CRDWait Readypoll pod readyCredentialsextract k8s secretBackup ConfigWAL + scheduledMetricsPodMonitor setupCompleteddatabase active
StageWhat Happens
VALIDATINGValidate request, check project name uniqueness
NAMESPACE_CREATIONCreate isolated Kubernetes namespace {orgId}-{projectName}
CRD_DEPLOYMENTApply CloudNativePG Cluster CRD via client-go dynamic client
WAITING_FOR_READYPoll all pods (primary + replicas) until Running and Ready
CREDENTIAL_GENExtract credentials from auto-created K8s Secret, encrypt with AES-256-GCM
BACKUP_CONFIGDeploy ScheduledBackup CRD with WAL archiving to S3
METRICS_SETUPEnable PodMonitor for STANDARD/ENTERPRISE tiers
COMPLETEDInstance marked ACTIVE, credentials available

Tiers

TierInstancesHAStorageMemoryCPUPodMonitor
FREE1No5Gi512Mi0.5No
STANDARD3Yes (1 primary + 2 replicas)50Gi4Gi2Yes
ENTERPRISE5Yes (1 primary + 4 replicas)500Gi16Gi4Yes

STANDARD and ENTERPRISE use CloudNativePG streaming replication with automatic failover. Promotion happens in under 30 seconds.

Quick Start

See the Quick Start guide to get a database running in 5 minutes.

GitHub

github.com/excalibase/excalibase-provisioning-poc