Kubernetes
Nido’s data layer is SQLite files on a volume, not a database server. That constrains the topology: every API pod that can serve a given family must be able to open that family’s file, and SQLite does not tolerate two writers.
Two manifests, two situations
Section titled “Two manifests, two situations”| Directory | Topology | Use when |
|---|---|---|
deploy/kubernetes/single-pod |
One pod, two containers | Single-node cluster, one household, the common case |
deploy/kubernetes/multi-pod |
Separate API and web deployments | You need to scale the web tier |
Start with single-pod. It is simpler, and it is the only topology that does not have to reason about two processes writing the same file.
Single pod
Section titled “Single pod”kubectl apply -k deploy/kubernetes/single-podkubectl -n nido get pods -wOne pod holds both containers, sharing a network namespace and the nido-data
volume. The web client reaches the API over the pod’s own loopback at
http://localhost:3000 (API_PROXY_TARGET) — which works only because both
containers share that namespace.
kubectl -n nido port-forward svc/nido 3001:80# web: http://localhost:3001svc/nido exposes both :80 → web and :3000 → api.
Manifests
Section titled “Manifests”namespace.yaml,secret.yaml,pvc.yaml— shared scaffoldingdeployment.yaml— one pod, two containers, shared PVC at/dataservice.yaml— exposesweb(:80 → 3001) andapi(:3000)
Secrets
Section titled “Secrets”The secret.yaml must contain both required values:
stringData: NIDO_MASTER_KEY: "…" # openssl rand -hex 32 JWT_SECRET: "…"Generate the key outside the cluster and apply it — never let a Secret in git
be the only copy. See the master key.
The filesystem is the real constraint
Section titled “The filesystem is the real constraint”Because a family’s encrypted file is the tenant boundary, a family can only be served by a pod that can open its file. That has consequences:
- ReadWriteOnce is honest. The default
pvc.yamlassumes one writer, which matches the SQLite constraint. ReadWriteManydoes not make it safe. NFS and similar can mount read-write-many, but SQLite over a network filesystem is still a single-writer design being shared by two processes.- Back up the PVC using the same procedure as the named volume, and separately. Same two-part requirement: Backup & restore.
- Backup & restore — the
kubectl execvariant - Configuration — every environment variable
- Containers & volumes — what lives where on disk