Skip to main content

High availability

API server replicas​

Set apiserver.replicas to 2 or more. The chart runs the API servers as a StatefulSet with a preferred anti-affinity across nodes and, with more than one replica, a PodDisruptionBudget that allows one replica to be unavailable.

Replicas are identical. Each one:

  • serves the API, and the authorization checks the workers' gateways send over their agents' links;

  • runs the reconciler, which claims work with leases fenced by a claim count, so that two replicas never handle the same workspace or volume at once;

  • keeps an in-memory copy of the runtime settings, refreshed on change and every 30 seconds.

  • runs background jobs, including the scheduled ones below. A job runs on one replica at a time under a lease; when that replica dies, another one picks the job up after 30 seconds.

JobIntervalPurpose
access.sweep_idle60 sPersist activity timestamps and stop idle workspaces.
user.collect_deleted30 sRemove deleted users once everything they owned is gone.
audit.prune1 hDelete audit records past their retention.
jobs.prune1 hDelete finished jobs past their retention.

There is no leader to elect. GET /v1/system reports the version and the name of the replica that answered.

A replica that dies in the middle of reconciling a workspace loses its claim after 60 seconds and another replica repeats the work. See Desired state and reconciliation.

The frontend is stateless; scale it with frontend.replicas.

Worker agents​

Each worker runs two agents by default (agent.replicas), both active: either applies commands and serves the worker's workspaces. One of them leads and alone does what needs doing once; an agent that lost its link to the control plane gives way to one that has it, and one that stops hands over at once and keeps serving until its gateway is drained, so that a rollout of the agents drops no request. See Workers.

PostgreSQL and Valkey​

The bundled PostgreSQL and Valkey are single instances. For high availability, run them outside the chart and point the platform at them:

values.yaml
apiserver:
replicas: 3

postgresql:
enabled: false
externalDatabase:
url: postgresql://idekube:password@postgres.example.org:5432/idekube

valkey:
enabled: false
externalValkey:
url: valkey://:password@valkey.example.org:6379/0

Both URLs are stored in the release secret. Each replica opens up to 40 connections to PostgreSQL; with several replicas, keep their sum under the server's max_connections by adding ?pool_max_conns=20, for example, to the database URL. Every connection also waits at most 30 seconds for a lock, idles in a transaction at most 5 minutes and runs a statement at most 5 minutes (migrations excepted); the URL changes these too, e.g. &statement_timeout=10min.

What each store means for availability:

  • PostgreSQL is the source of truth. Without it the API does not answer and nothing is reconciled. Running workspaces keep running, and requests to them keep being admitted as the workers' gateways keep a decision: an allowed one stands a minute, and up to 15 minutes while the control plane does not answer.
  • Valkey holds refresh tokens, pending sign-ins and buffered activity timestamps, and carries notifications between replicas. Losing its data signs users out of the UI once their access token expires and may delay an idle stop; no resource is lost. Notifications are only hints: every replica also polls the database.