PrepZone Logo
PrepZone

Dev, Staging, Prod: Environment Strategy

Parity, promotion gates, configuration drift, and why staging must mirror production.

Why this matters

  • This topic directly affects how reliably BookStore reaches production — environments are promotion stages with parity rules.
  • Interviewers connect hands-on commands and manifests to real delivery stories, not buzzwords.
  • Later modules assume you can explain both the why and the concrete file or command involved.
  • Platform maturity shows up when teams automate this instead of relying on tribal knowledge.
Rolling
v1.0 pods3 running
v1.1 pod addedOne at a time
v1.0 pods removedZero downtime
Blue/Green
Blue (v1.0)Live traffic
Green (v1.1)Validated, idle
Switch trafficInstant cutover
Rolling replaces pods gradually. Blue/green switches traffic between two full environments.

Standard environments

Developers iterate locally with Compose. Staging runs the same Kubernetes chart as production with smaller replicas and anonymised data.

Key ideas

  • Development — fast feedback, local dependencies
  • Staging — production-like networking and config shape
  • Production — real traffic and strict change control

Promotion flow

BookStore auto-deploys main to staging on green CI. Production promotion requires approval, synthetic checkout test, and comparison of error budget burn.

Key ideas

  • Gates — automated tests plus human approval
  • Parity — same Helm chart, different values
  • Config drift — detect with GitOps diff
  • Rollback — redeploy previous image digest

Configuration parity

Environment differences live in ConfigMaps, Secrets, and Helm values — never in divergent Dockerfiles.

Key ideas

  • SPRING_PROFILES_ACTIVE — profile per env
  • Secrets — injected at deploy, not baked in images
  • Data — synthetic orders in staging
  • Feature flags — decouple deploy from release
Java
apiVersion: v1
kind: ConfigMap
metadata:
  name: bookstore-config
  namespace: staging
data:
  SPRING_PROFILES_ACTIVE: staging
  LOG_LEVEL: debug

Quick recall

Everything you need if you only revisit this box.

  • BookStore uses environments and promotion as a standard delivery practice.
  • Prefer automation and versioned config over manual server changes.
  • Staging proves changes before customer-facing promotion.
  • Observability confirms success — do not rely on silence alone.
  • Rollback plans must be tested, not invented during an outage.
  • Security and least privilege apply to every pipeline and cluster role.

Test yourself

Answer these before moving on — recall is what makes it stick.