Chapter 9 of a local-Kubernetes series: the stateful-dependencies chapter the earlier ones deliberately deferred. Bring up your backing services in the cluster so local structurally matches prod — and avoid a 2025 supply-chain landmine.
Key takeaways
-
Why in-cluster, not compose-on-the-side: one world, not two. In-cluster Postgres/Redis/RabbitMQ gets you unified DNS/service discovery (app finds the DB at
postgres, notlocalhost:5432), shared Secrets/ConfigMaps, and you catch RBAC/limits/probe problems before rollout. (Fair: compose is a legit choice if the service isn't going to k8s.) -
The Bitnami warning without which this chapter would be harmful: since 2025-09-29 most public Bitnami OCI charts/images moved behind a Broadcom subscription; the rest are
bitnamilegacy(unsupported, no security patches). Don't blindly recommendbitnami/*in 2026. Use Chainguard's drop-in charts, official operators, or a deliberately-pinned legacy tag (dev only). -
The most predictable dev path is a raw 3-object manifest: Deployment (official
postgres:17) + Service (stable DNSpostgres) + PVC — no chart repos, no subscription dependency. Includes apg_isreadyreadiness probe. -
The big storage surprise: in k3d, data is ephemeral by default —
local-path-provisionerwrites inside the node container, sok3d cluster deletewipes it. To persist, map a host dir at create:--volume $HOME/k3d-storage:/var/lib/rancher/k3s/storage@all. -
Wire into Tilt: feed the manifest to
k8s_yaml, order startup withresource_deps(myappwaits forpostgres's readiness),port_forwards=['5432:5432']to reach it from your IDE. -
Migrations: a separate Job (+ initContainer wait), ordered
postgres → migrate → seed → myapp. Migrations in the app's own initContainer is an anti-pattern (races across replicas, probe kills). Note Tilt's built-inhelm()skips hooks — usehelm_resourcefor anything with init hooks. - Mock vs run: OSS deps (Postgres/Redis/RabbitMQ) → run as-is; proprietary managed (S3/SQS/DynamoDB) → emulate with LocalStack, but it's not 1:1 (IAM, consistency, edge cases).
Top comments (0)