12 · Deployment & operations
Status: Implemented (T19 infrastructure, T20 CI and cutover) · Owner: Platform ·
Runbook: deploy/README.md in the repository
Flux runs in namespace flux on the Nasterra k3s cluster (two nodes joined over
WireGuard), from GitLab nasterra/flux, branch master, at flux.nasterra.com.
Images
Section titled “Images”| Image | Built from | Contains |
|---|---|---|
engine |
engine/Dockerfile |
flux-runner (entrypoint), flux-dataset, flux-preview, flux-forge, flux-cli; connector binaries in /opt/flux/connectors for publishing |
api |
control-plane/Dockerfile |
FastAPI control plane + flux-cli copied from the engine image of the same commit |
web |
deploy/web/Dockerfile |
nginx (unprivileged) serving the site and docs at / and the app at /app |
- Tags are the commit’s short SHA (immutable) plus
latest. - Kaniko builds in the in-cluster runner; no Docker daemon.
- Everything stays on the LAN / WireGuard: CI pushes to the GitLab registry’s internal
endpoint
10.0.0.18:5050(plain HTTP, a GitLab-managed nginx server in/etc/gitlab/nginx-custom/), both nodes pullregistry.nabil.ie/…through it (k3sregistries.yamlmirror, public URL as fallback), and the runner talks to GitLab athttp://10.0.0.13, so artifacts don’t pass Cloudflare either. Only the small token request goes todevops.nabil.ie. - Layers are still kept small (each Rust binary, connector and large Python dependency set in its own layer) so the public registry URL keeps working as a fallback.
- Rust builds use profile
dist(release, 16 codegen units) so they fit a CI pod’s memory. - Every container runs as a non-root user with a read-only root filesystem, no
privilege escalation, all capabilities dropped and the RuntimeDefault seccomp
profile; writable paths are
emptyDirvolumes.
Placement
Section titled “Placement”The two nodes are 30–200 ms apart (measured). Placement follows the latency-sensitive paths:
flowchart LR
subgraph vps[k3s-vps · public]
edge[host nginx :443] --> ing[ingress-nginx]
ing --> web & dataset
dataset[dataset ×2] --> objects[(objects<br/>S3)]
preview --> objects
forge --> objects
jobs[run Jobs] --> objects
end
subgraph vm[k3s-vm]
api --> enki[(enki<br/>Postgres)]
api --> nats[(NATS)]
end
ing --> api
api -. Jobs .-> jobs
dataset -. catalog, WAL .-> enki
jobs -. catalog .-> enki
- Key lookups (
/api/datasets) go ingress → dataset → object storage, all on k3s-vps. Cached file lists and footers mean no catalog round trip per request; the staleness window is 30 s (commit events invalidate sooner). - The API sits with enki and NATS: it makes many small queries per request.
- Run Jobs prefer k3s-vps so staging writes and commits stay next to storage
(
FLUX_RUNNER_PREFER_NODE); they still run on k3s-vm if the VPS is full.
Manifests
Section titled “Manifests”| File | Applied | Contents |
|---|---|---|
deploy/k8s/cluster/namespace.yaml, storage.yaml, rbac.yaml |
once, cluster-admin | namespace; local PVs (/data/flux/nats on k3s-vm, /var/lib/flux/objects on k3s-vps); ci-deployer and flux-api service accounts |
networkpolicy.yaml |
CI | default deny into flux; only the ingress reaches web/api/dataset; only Flux pods reach NATS and object storage; Forge also from the CI publish job |
nats.yaml, objects.yaml |
CI | StatefulSets on their local volumes |
migrate-job.yaml |
CI | python -m flux_cp.migrate (idempotent create_all under an advisory lock) |
engine.yaml |
CI | forge, dataset (2 replicas, PDB), preview |
api.yaml, web.yaml, ingress.yaml |
CI | API (1 replica, Recreate), web (2), routing |
deploy/k8s/apply.sh applies them in order: infrastructure, migration (a failure
stops the rollout), services, ingress.
Identities. ci-deployer can manage workloads, services, secrets, network
policies and ingresses in flux only, and can’t create namespaces or RBAC.
flux-api (the orchestrator) can create and delete Jobs and Secrets and read pod
logs in flux; it can’t read other secrets. Run Job pods get no service account
token.
Secrets
Section titled “Secrets”Created by deploy/k8s/bootstrap_secrets.py, one per service so each gets only what
it uses. Existing values are kept on re-runs. FLUX_SECRET_KEY (sessions and API keys)
and FLUX_VAULT_KEY (stored connection credentials) are never replaced automatically.
The Forge signing key exists only as a masked GitLab variable; the cluster holds the
public key. Details in the runbook.
Upgrades and schema
Section titled “Upgrades and schema”The migration Job creates missing tables before each rollout; existing tables aren’t altered. A release that changes columns needs a hand-written migration until Alembic is added (open question).
Backups
Section titled “Backups”| Data | Where | Backup |
|---|---|---|
| Control plane, catalog, Forge metadata, WAL | enki database flux |
enki’s backups (cluster-wide) |
| Parquet files, Forge bundles | /var/lib/flux/objects on k3s-vps |
Not yet automated (open question). Files are immutable; a nightly rsync to k3s-vm /data is the plan |
| Events | /data/flux/nats |
None needed: run state lives in Postgres; streams are bounded history |
Open questions
Section titled “Open questions”- Alembic migrations for column changes.
- Automated object storage backups and a restore drill.
- Client IPs behind Cloudflare: audit entries show the edge’s view of the client.