DBeaver + kubectl — the local database cockpit
:::note Supersedes the in-cluster Adminer console (2026-11-21)
The browser-based Adminer cockpit (an ArgoCD-deployed, SSO-gated pod with netpol reach into DB
namespaces) was retired in favour of a local DBeaver CE client tunnelling over kubectl port-forward. Rationale: zero cluster footprint (nothing to attack/patch), access bounded by your own
kubeconfig RBAC, one tool covering PostgreSQL + MariaDB + ClickHouse, and dev/prod visual guardrails
(red + read-only on production) that Adminer could not provide. The operational counterpart to the
auto-generated schema ERDs — tbls documents the schema
in Git; DBeaver is the hands-on console to inspect/query/debug live data. Two different jobs.
:::
What it is / isn't
- Is: a local desktop SQL client to browse tables, run read queries, analyse locks, trace a bug across every relational DB on the platform (~20 PostgreSQL, 3 MariaDB, 1 ClickHouse).
- Isn't: a design canvas, and not how schema changes happen. Schema changes stay in migrations (Flyway/Alembic/golang-migrate/Drizzle) → GitOps. DBeaver is read/inspect/operate.
How it's safe (the model)
| Control | Implementation |
|---|---|
| No cluster footprint | DBeaver runs on your laptop. Nothing is deployed in k8s — the retired Adminer pod/ingress/netpols are gone. |
| Access = your RBAC | reach is only ever your own kubectl (OIDC context minicloud-oidc); there is no standing in-cluster service with broad DB reach. |
| Exposure | DBs are ClusterIP-only. The sole path is a kubectl port-forward to localhost — never a public route. |
| Primary routing | CNPG HA clusters are reached via the <cluster>-rw Service, which always follows the current primary across a failover (never a pod or the read-only -ro/-r service). |
| No secrets at rest in Git | the connection file carries no passwords (save-password: false); credentials are pulled per-session from the k8s Secret into DBeaver's master-password store. |
| Prod guardrail | every production connection is tagged Connection type = Production (red header/tabs) + read-only by default — an explicit, deliberate toggle is needed to write. |
Setup (one-time)
brew install --cask dbeaver-community # macOS; CE covers PG / MariaDB / ClickHouse / SQLite
Helper scripts + the connection generator live in minicloud-ops/scripts/db/ (committed, reusable):
| File | Purpose |
|---|---|
db-targets.tsv | single source of truth — one row per DB (local port · ns · service · engine · env · secret) |
db-portforward.sh <ns> <svc> <localport> [remoteport] | open ONE forward |
db-forward-all.sh [filter] | open every (or a filtered) forward at once; Ctrl-C tears them all down |
gen-dbeaver-sources.py | emit a DBeaver-importable data-sources.json from db-targets.tsv (prod → red + read-only) |
Daily use
# 1. open the tunnels (all, or filter to e.g. prod / ktayl):
cd ~/Developer/cloudplateform/minicloud-ops/scripts/db
./db-forward-all.sh # KCTX defaults to minicloud-oidc; on the controller use KCTX=default
# 2. (first time) import the connections into DBeaver:
./gen-dbeaver-sources.py > /tmp/dbeaver-data-sources.json
# DBeaver → File → Import → DBeaver → Project / connections → pick the file; verify one dev + one prod.
# 3. connect; DBeaver dials localhost:<port> through the open forward.
Local-port map (from db-targets.tsv)
PostgreSQL 554xx · MariaDB 533xx · ClickHouse 58123. Representative rows (prod = red + read-only):
| Port | Namespace / service | Engine | Env |
|---|---|---|---|
| 55438 | ktayl-core-prod / ktayl-core-cnpg-rw | postgres | prod |
| 55437 | ktayl-core / ktayl-core-cnpg-rw | postgres | dev |
| 55440 | ktayl-iam-prod / ktayl-iam-cnpg-rw | postgres | prod |
| 55445 | underwriting-prod / underwriting-postgres-rw | postgres | prod |
| 55444 | underwriting / underwriting-postgres-rw | postgres | dev |
| 55443 | retrieva / retrieva-cnpg-rw | postgres | prod |
| 55432 | authentik / authentik-cnpg-rw | postgres | prod |
| 53306 | erp / erpnext-mariadb-sts | mariadb | prod |
| 53308 | itsm / glpi-mariadb | mariadb | prod |
| 58123 | langfuse / langfuse-clickhouse | clickhouse | prod |
The full set (23 connections) is in
db-targets.tsv— the scripts and the generator all read it, so add or retune a DB in one place.
Pulling credentials per-session (never stored in Git)
CNPG clusters put the app login in the <cluster>-app Secret (kubernetes.io/basic-auth: username /
password / dbname):
NS=underwriting CL=underwriting-postgres # example (dev)
kubectl --context minicloud-oidc -n $NS get secret ${CL}-app \
-o jsonpath='{.data.username}{"\t"}{.data.dbname}' | xargs -0 -I{} sh -c 'echo {} | base64 -d' # user + db
kubectl --context minicloud-oidc -n $NS get secret ${CL}-app -o jsonpath='{.data.password}' | base64 -d; echo
Plain-StatefulSet / vendor DBs use an Opaque secret with varying keys — discover them with:
kubectl --context minicloud-oidc -n <ns> get secret <name> -o go-template='{{range $k,$v := .data}}{{$k}}{{"\n"}}{{end}}'
Paste the password into DBeaver on first connect (master-password store); it is never written to the file.
Where these credentials actually come from (Vault → ESO vs CNPG operator-generated, and the storage discipline) → Where database credentials live.
Companion tools (out of DBeaver CE scope)
| Store | Tool |
|---|---|
| Redis / Valkey (~11) | RedisInsight (free desktop) — port-forward the Redis service the same way |
OpenSearch (yente) | OpenSearch Dashboards (already web-based) |
Qdrant (ai) | Qdrant built-in web UI at :6333/dashboard (port-forward svc/qdrant) |
Verify (run it — these are real results)
# tunnel + credential + query path, end-to-end (what DBeaver does over JDBC):
cd ~/Developer/cloudplateform/minicloud-ops/scripts/db
KCTX=minicloud-oidc ./db-portforward.sh underwriting underwriting-postgres-rw 55444 5432 &
# → nc -z localhost 55444 → "localhost:55444 OPEN"
# → psql -h localhost -p 55444 -U underwriting -d underwriting -tAc 'select 1,current_database(), …'
# → SELECT_OK|underwriting|200 (200 tables; creds pulled from underwriting-postgres-app)
For the full inventory of databases this cockpit covers, see the schema ERD index.