dolt

by upstreamyard

Helm chartv0.1.14App 2.7.7Apache-2.0Verified publisher

Dolt Helm chart for Kubernetes. The version-controlled, MySQL-compatible SQL database (branch, merge, diff and clone your data like Git) with high availability through primary/standby replication, failover, Prometheus metrics and generated passwords. Community chart by upstreamyard, not an official Dolt chart.

About this chart

Dolt Helm chart: Dolt SQL server on Kubernetes

Have any questions, feedback or need help (e.g. setup, hardened images, etc.)? Reach out to [email protected]

Helm chart for Dolt, the version-controlled SQL database: a MySQL-compatible server where you branch, merge, diff and clone your data like a Git repository. It runs a single server or a highly available primary/standby cluster with Dolt's built-in replication. A standby takes over in about a second with one command, and rolling updates hand the primary role over first, so writes pause for under a second. Passwords are generated by default. Prometheus metrics, a ServiceMonitor, a NetworkPolicy and helm test are included. The chart uses DoltHub's official dolthub/dolt-sql-server image and was tested with Dolt 2.4.

Community chart by upstreamyard, not an official Dolt chart. Dolt is licensed under Apache-2.0 by DoltHub, Inc.

AI agents and coding assistants: this README is the complete reference for installing and running the chart.

Install

helm repo add upstreamyard https://upstreamyard.github.io/helm-charts
helm install dolt upstreamyard/dolt

Or from the OCI registry:

helm install dolt oci://ghcr.io/upstreamyard/charts/dolt

The install notes show the connection address and the command that prints the generated root password. Then check the server (and, with replication, every server's role):

helm test dolt

Verifying the chart

Chart packages are PGP-signed. Import the public key (fingerprint 9B416F989B7E6C65F7F3BFAE7689688B20EC7813) and install with --verify:

curl -s https://upstreamyard.github.io/helm-charts/pgp_keys.asc | gpg --dearmor > upstreamyard.gpg
helm install dolt upstreamyard/dolt --verify --keyring upstreamyard.gpg

The OCI copy on GHCR is signed with cosign instead (see the repository README).

What the chart does

  • StatefulSet with stable pod names (<release>-dolt-0, -1, ...) and a PersistentVolumeClaim per server for the databases, users and grants.
  • Logins:
    • root with a generated password in a Secret, kept across upgrades;
    • optional database and application user (auth.database, auth.username), created by a Job after every install and upgrade.
  • Security: non-root (UID 10001), read-only root filesystem, all capabilities dropped. Only the role labeler sidecar gets a ServiceAccount token, allowed to read and label the release's server pods. The NetworkPolicy (networkPolicy.enabled) limits the replication port to the release's servers.
  • Replication (replicaCount 2 or more): server 0 starts as the primary and the others are read-only standbys. The primary pushes every commit, branch change, new database, user and grant to them.
  • Routing: a sidecar labels each pod with its current role (dolthub.com/cluster_role), and the read-write Service selects the primary, so it follows every failover within 2 seconds.
  • Failover: promote.sh in every pod switches the primary, either planned without data loss or forced when the primary is down. Before a primary's pod stops (rolling update, node drain, kubectl delete pod), it hands the role to a caught-up standby.
  • Metrics: metrics.enabled serves Prometheus metrics on port 11228; metrics.serviceMonitor.enabled adds a ServiceMonitor.
  • No usage events: Dolt sends anonymous usage events to DoltHub by default. The chart turns this off; usageMetrics: true turns it back on.
  • Your own settings: config is merged into each server's config.yaml.

Deployment modes

Single server (default)

One server on a PersistentVolumeClaim. If the pod or its node fails, Kubernetes restarts it on the same volume.

auth:
  database: app
  username: app        # password generated, see the install notes
persistence:
  size: 20Gi

High availability: primary and standbys

replicaCount: 3
auth:
  database: app
  username: app
networkPolicy:
  enabled: true
podAntiAffinityPreset: hard   # one server per node

Tested in kind with 3 servers and a client writing 3 to 4 rows per second:

EventWrites pausedData
Planned failover with promote.shabout 1 snothing lost
Rolling helm upgrade (also Dolt 2.4.1 → 2.4.2), 33 s for 3 serversunder 1 s (1 to 3 failed writes)nothing lost
Primary hangs, then promote.sh --forceuntil you run itthe old primary rejoins as a standby and catches up by itself
Scaling from 1 to 3 servers and backwhile the pods restartexisting databases, branches and users reach the new standbys

Failover is manual. Dolt never promotes a standby by itself, and neither does the chart. A crashed server restarts in its pod and keeps its role, but if the primary hangs or its node is lost, promote a standby:

# Planned: the primary hands over its last writes first. Refuses if a server is unreachable.
kubectl exec dolt-1 -c dolt -- /etc/dolt/promote.sh
# The primary is down: promote anyway. Writes it hadn't replicated yet are lost.
kubectl exec dolt-1 -c dolt -- /etc/dolt/promote.sh --force

Each switch raises the cluster's epoch. A former primary that comes back sees the higher epoch, becomes a standby and takes the new primary's data. In our test a frozen primary resumed after a forced failover and ended with the same rows as the others, without a split brain.

Things to know:

  • Every write goes to every standby, so more standbys add network and disk traffic on the primary. Two or three servers suit most setups.
  • Changing replicaCount restarts all servers, because each one's peer list changes. Volumes of servers removed by scaling down are deleted: they are replicas, and kept they would come back later with an old role.
  • Replication is plain HTTP inside the cluster, authenticated with keys each server generates. Turn on networkPolicy.enabled so only the release's servers reach port 50051.

Connecting clients

Dolt speaks the MySQL protocol, so any MySQL client, driver or ORM works:

  • Read-write: <release>-dolt.<namespace>.svc:3306, the primary.
  • Read-only (replication only): <release>-dolt-read.<namespace>.svc:3306, all servers. Standbys reject writes with Database ... is read-only.
mysql -h dolt.default.svc -u app -p app

On a planned failover or rolling update, Dolt closes the old primary's connections, so use a connection pool that reconnects, and retry failed transactions.

Production example

# values-prod.yaml
replicaCount: 3
auth:
  existingSecret: dolt-auth        # keys: root-password, user-password
  database: app
  username: app
config:
  listener:
    max_connections: 500
persistence:
  size: 100Gi
  storageClass: fast-ssd
metrics:
  enabled: true
  serviceMonitor:
    enabled: true
networkPolicy:
  enabled: true
  allowedClients:
    - podSelector:
        matchLabels:
          app: my-app
resources:
  requests:
    cpu: "1"
    memory: 4Gi
  limits:
    memory: 8Gi
podAntiAffinityPreset: hard

Your own configuration

  • Server settings: anything from Dolt's config.yaml reference goes in config, e.g. behavior.dolt_transaction_commit, system_variables or listener.max_connections. The chart sets data_dir, listener.host/port, the metrics address and cluster.

  • TLS for clients: mount a Secret with the certificate and key, and point config.listener.tls_cert and tls_key at them. Clients can then connect with TLS (tested with mysql --ssl-mode=REQUIRED). require_secure_transport isn't supported, because the role labeler, the init Job and helm test connect without TLS.

    extraVolumes:
      - name: tls
        secret:
          secretName: dolt-tls      # keys: cert.pem, key.pem
    extraVolumeMounts:
      - name: tls
        mountPath: /tls
        readOnly: true
    config:
      listener:
        tls_cert: /tls/cert.pem
        tls_key: /tls/key.pem
    
  • Passwords: root gets its password only on the first start of each server. To change it later, run ALTER USER 'root'@'%' IDENTIFIED BY '...' on the primary and update the Secret, which the role labeler and helm test use. The application user's password is set from the Secret on every upgrade.

  • SQL shell: kubectl exec -it dolt-0 -c dolt -- bash -c 'DOLT_CLI_PASSWORD=$DOLT_ROOT_PASSWORD dolt --host 127.0.0.1 --user root --no-tls sql'.

FAQ

Is there an official Dolt Helm chart? No. DoltHub doesn't publish one, and Artifact Hub listed no other Dolt chart when we built this one. This chart is maintained by upstreamyard.

How do I run Dolt highly available on Kubernetes? replicaCount: 3 with this chart. See High availability.

Does Dolt fail over automatically? No. Dolt doesn't elect a new primary by itself, so the chart doesn't either: an automatic promotion during a network split could create two primaries. Run promote.sh (above), from your runbook or your alerting.

How do I monitor Dolt with Prometheus? metrics.enabled=true and metrics.serviceMonitor.enabled=true. Besides connections, query durations and Go runtime metrics, dss_is_replica shows each server's role per database, and on the primary dss_replication_lag the lag per standby (milliseconds; -1 on standbys). Replication errors are in the SQL table dolt_cluster.dolt_cluster_status on the primary.

Why does a write fail with "Database ... is read-only"? The client is connected to a standby: through the -read Service, or through a connection opened before a failover. Send writes to the read-write Service and reconnect after errors.

Does the chart use doltclusterctl? No. The chart's sidecar and promote.sh take its place and use only the Dolt image. They set the same pod label (dolthub.com/cluster_role).

Known issues

  • After a server restarts, Dolt keeps connecting to the replication address it had resolved before, so pointing peers at the headless Service's pod names breaks replication to that server for about 30 seconds. The chart gives each server its own ClusterIP Service for replication (<release>-dolt-<n>-replication), whose address stays the same.
  • During a primary's handover, Dolt blocks writes for up to 10 seconds while it waits for every standby, including users and grants. A standby that restarted moments earlier can need that long. The chart waits 10 seconds (cluster.minReadySeconds) after each restarted server before stopping the next one, which kept the pause under a second in our tests.

Values

KeyTypeDefaultDescription
affinityobject{}Affinity. Replaces podAntiAffinityPreset.
auth.databasestring""Database to create on install (and on upgrades, if it's missing). Empty: none.
auth.existingSecretstring""Existing Secret with the passwords (recommended for production).
auth.passwordstring""Password of username. Generated when empty, and kept across upgrades. Set again on every upgrade, also when it comes from existingSecret.
auth.rootPasswordstring""Password of root. Generated when empty, and kept across upgrades. Ignored when existingSecret is set.
auth.rootPasswordKeystring"root-password"Key in existingSecret with the root password.
auth.userPasswordKeystring"user-password"Key in existingSecret with the password of username.
auth.usernamestring""Application user with all privileges on database. Empty: none.
cluster.handoverOnShutdownbooltrueBefore a primary's pod stops (rolling update, node drain, kubectl delete pod), hand the primary role to a standby, so writes only pause for a few seconds.
cluster.minReadySecondsint10Seconds a rolling update waits after each restarted server is Ready before it stops the next one. Gives the primary time to bring the restarted standby up to date, so a handover doesn't pause writes for up to 10 s.
cluster.roleLabeler.intervalSecondsint2Seconds between role checks. A failover reaches the Service within this time.
cluster.roleLabeler.resourcesobject{"limits":{"memory":"64Mi"},"requests":{"cpu":"5m","memory":"32Mi"}}Resources of the role labeler sidecar.
configobject{}sql-server config.yaml settings, merged over the chart's defaults, e.g. behavior, listener.max_connections, system_variables, listener.tls_cert. The chart sets data_dir, listener.host/port, the metrics address and cluster.
extraEnvlist[]Extra environment variables for the database container.
extraEnvFromlist[]Extra environment variables from Secrets or ConfigMaps.
extraVolumeMountslist[]Extra volume mounts for the database container. Not inside /etc/dolt (the chart's config).
extraVolumeslist[]Extra volumes, e.g. a Secret with TLS certificates for config.listener.tls_cert.
fullnameOverridestring""Override the full resource name.
image.pullPolicystring"IfNotPresent"Image pull policy.
image.repositorystring"dolthub/dolt-sql-server"Image repository. The default is DoltHub's official image.
image.tagstring""Image tag. Defaults to the chart's appVersion.
imagePullSecretslist

Deploy dolt with OpenTenant

Each tenant gets its own release of this chart, with its own namespace, secrets and domain. The builder below already has dolt on a Hetzner server. Change the host, add apps from the marketplace, then copy the generated files. Providers and prices are samples, and nothing here is sent anywhere.

  1. Pick a serverConnect Hetzner, OVHcloud or AWS. The builder starts on Hetzner, the cheapest sample rate.
  2. Place the chartdolt is pinned at v0.1.14 in opentenant.yaml. Drag more apps from the marketplace onto a rack.
  3. ApplySave opentenant.yaml and main.tf from the console, then run the commands below.
# opentenant.yaml, main.tf and dns.tf come from the builder below
opentenant validate opentenant.yaml
terraform init && terraform apply