Video in progress

How do you build the dev, stage and prod environment strategy, and how do you solve the problem that staging "does not look like prod"?

I build environments from the same manifests and image, differing only in configuration. Instead of one shared staging, I use short-lived preview environments per PR, and for prod-specific bugs the main protection is not staging but canaries and feature flags.

📖 Answer

The typical problems of a shared staging: 10 teams deploy at once and break each other's tests; the data is stale; versions differ from prod; nobody owns it, so it is always "a bit broken". As a result a release that was green in staging fails in prod, and the team stops trusting staging.

What I do:

The same artifact and manifest: with a Kustomize overlay or Helm values, the difference is only in parameters: replica count, resources, URLs. If -Xmx is different in prod and in staging, that is already a difference.

Preview environments: a namespace per PR, with the changed service on the new version and the rest connecting to the shared stable version (or a mock). It is deleted when the PR is closed. This removes the traffic jam on the shared staging. The cost: cluster resources and automation to prepare test data.

Staging's role is narrowed: integration, migration rehearsal, load testing. It does not have to be a "copy of prod", which is impossible anyway.

Safe testing in prod: real data, real load and the real network exist only in prod. So the main investment goes into canaries, feature flags and dark launches (the new code computes the result but does not show it to the user).

The data question is separate: copying prod data into staging runs into personal data laws. You need masked or synthetic data generation, and that is a project of its own.

The fewer environments, the better. Every new environment means upkeep, upgrades and questions like "why does it work there and not here?"