Using k3s SQLite Datastore: A Lightweight Edge‑Ready Alternative to etcd
Run a single‑node k3s cluster with SQLite instead of etcd, gaining low memory footprint while keeping full API compatibility.
06 Aug 2026, 22:17 UTC

Problem and Takeaway
You are running a single‑node edge device or a developer workstation and need a Kubernetes control plane without the memory‑hungry etcd component. The usual trade‑off is to run a full etcd cluster, which adds complexity and consumes resources that are often scarce at the edge. k3s offers a built‑in SQLite datastore that replaces etcd, giving you a fully compatible API server with a dramatically smaller footprint.
Takeaway: Enable k3s’ SQLite datastore and you get a production‑ready control plane that fits on devices with as little as 256 MiB RAM while preserving the Kubernetes API you already know.
Why SQLite Matters in k3s
The SQLite mode is an optional feature that swaps the default etcd backing store for a local SQLite database file. From version 1.24 onward the flag --sqlite-database is stable, and the API server continues to speak the same Kubernetes JSON over HTTP, so all kubectl commands work unchanged.
Key benefits include:
- Reduced memory and CPU usage – the SQLite file typically stays under 10 MiB.
- Simpler deployment – a single binary and one data file, no external etcd process.
- Full API compatibility – no changes required in manifests or controllers.
Performance tests on a typical edge workload show sub‑millisecond API latency for most reads and writes. However, high‑concurrency scenarios can hit SQLite’s write‑lock limits, leading to brief API errors. The datastore is not HA; a single node failure loses the database unless you back it up externally.
Enabling SQLite: A Worked Example
Below is a concrete, step‑by‑step example for a fresh edge node running Ubuntu 22.04. All commands assume root privileges.
curl -sfL https://get.k3s.io | sh -This installs the k3s binary and creates a systemd service.
mkdir -p /var/lib/k3s # Choose a location that persists across upgrades # Example: /var/lib/k3s/sqlite.dbCreate the SQLite file (the binary will create it automatically if it does not exist).
k3s install --sqlite-database /var/lib/k3s/sqlite.db --disable=etcdKey flags explained:
--sqlite-database: path to the SQLite file that will hold the etcd‑compatible key‑value store.--disable=etcd: prevents k3s from starting an etcd container or process, ensuring SQLite is the only datastore.
systemctl restart k3sVerify that the SQLite flag is present in the service arguments.
k3s checkExpected output includes a line similar to “SQLite datastore enabled”. If you see “etcd” still listed, the flag was not applied.
kubectl get nodesSuccessful output confirms the API server is healthy and no etcd processes are running.
Risk note: The SQLite file must be preserved during any k3s upgrade; otherwise the control plane will lose its state and the cluster will become unavailable.
Trade‑offs and Limitations
While SQLite offers clear advantages for low‑resource environments, it also introduces constraints that affect production readiness:
- No high availability: A single node failure means loss of the datastore. For critical edge deployments you should either back up the SQLite file regularly or run a fallback etcd cluster on a separate node.
- Write‑lock contention: SQLite uses a file‑level lock. If many controllers or pods issue concurrent writes, the API server may return
500errors once the lock timeout (default 5 seconds) is exceeded. Tuning--sqlite-wal-sizecan mitigate this, but it adds complexity. - Future deprecation risk: The roadmap indicates k3s may move to an embedded key‑value store in upcoming releases. Pinning a compatible k3s version (e.g., 1.24.x) ensures continued SQLite support.
In practice, SQLite is ideal for dev clusters, single‑node gateways, and edge IoT gateways where simplicity and low resource usage outweigh the need for HA.
Actionable Closing
To decide whether SQLite is right for your edge or dev workload, follow this checklist:
- Confirm your environment runs a single control‑plane node with limited RAM/CPU.
- Enable SQLite via
k3s install --sqlite-database /path/to/db --disable=etcd. - Run
k3s checkandkubectl get nodesto verify health. - Implement a backup strategy for the SQLite file (e.g., periodic
cpto a remote store). - Monitor API latency; if you see frequent lock‑wait errors, consider increasing
--sqlite-wal-sizeor switching back to etcd.
By weighing the reduced footprint against the lack of HA, you can make an informed engineering decision that keeps your edge cluster lightweight while preserving full Kubernetes compatibility.
0 replies
A thoughtful contribution can make all the difference. Be the first to share one.