Safe Deployment and Rollback Strategies Questions
Releasing changes to production safely and incrementally, and recovering when they fail: blue-green, canary, and rolling deployments, feature flags, dark launches, traffic shifting, and progressive rollout, together with rollback strategies, safe-deploy practices, blast-radius containment, automated recovery, and safe forward/backward migration. Covers deployment orchestration across cloud platforms, staged exposure of new behavior to users, assessing deployment risk, designing reversible releases, and restoring a known-good state quickly. Focuses on how a release reaches production and how it is unwound on failure, distinct from broader incident command, which lives in Enterprise Operations & Incident Management.
You're an SRE at an org whose release process has no formal rollback policy, and engineers are reluctant to pause a release. How would you get product and engineering to adopt SLOs, rollback runbooks, and automated gates while preserving reasonable velocity?
Sample Answer
Direct answer
Getting a team to adopt SLOs, rollback runbooks, and automated gates when there's currently no formal policy and engineers are reluctant to pause releases is fundamentally a trust and incentive problem before it's a technical one: you need to show, cheaply and with data, that the current lack of process is already costing them something they care about, then introduce the change in a way that doesn't feel like it's slowing them down for its own sake.
Structured elaboration
- Start with data, not policy: pull the team's actual recent incident history and show the pattern (how many were release-caused, how long they took to resolve, what would have caught them earlier). A concrete "here's what this cost us last quarter" lands better than an abstract argument for process.
- Propose the smallest viable version first: a lightweight SLO on the single highest-value service, a one-page rollback runbook for the most common failure mode, not a company-wide mandate on day one. Small, visible wins build the credibility to expand.
- Frame gates as protecting velocity, not blocking it: an automated error-budget gate that only fires when things are ALREADY going wrong lets a team ship faster and with more confidence the REST of the time, since they're not manually second-guessing every release out of institutional caution.
- Involve the reluctant engineers in DEFINING the SLO and the runbook, rather than handing them a policy from outside; people who help write a threshold are much less likely to see it as an arbitrary obstacle later.
- Make the automation the "bad cop" instead of a person: once a gate exists, "the pipeline blocked it" is a much less politically fraught conversation than a manager or SRE manually saying no to a release.
Worked example
A team resisting SLOs after a string of near-misses: rather than proposing a full SLO framework, start with one metric (error rate) on their single most customer-visible endpoint, set a deliberately generous initial threshold (so it almost never fires early on and doesn't feel punitive), and pair it with a one-page runbook for their most common incident type written WITH the on-call engineers, not handed to them. After a quarter of it quietly preventing one or two bad releases from reaching full rollout, the team is far more receptive to extending the same pattern to other services, because they've seen it work rather than been told it will.
Trade-offs and pitfalls
Moving too fast with a heavy, comprehensive rollout of SLOs/gates/runbooks all at once tends to trigger exactly the resistance you're trying to overcome, since it reads as bureaucracy imposed from outside; moving too slowly risks another preventable incident happening before the safety net exists. The balance is a small, credible first step that earns the trust to expand, rather than either extreme.
A recent deployment included a schema change that turned out to be irreversible, and it degraded production; rolling back the code alone won't restore the data. Walk through your prioritized recovery plan.
Sample Answer
Direct answer
When a schema change has already degraded production and rolling back the code alone can't restore the lost or corrupted data, the priority order is: stop further damage first, restore user-facing service using whatever means are available even if imperfect, THEN work on true data recovery, because service continuity and data integrity often need to be addressed in that sequence rather than simultaneously.
Structured elaboration
- Stop the bleeding: halt any further writes that would compound the damage (pause the affected write path via a feature flag or by scaling down the writer if there's no flag), so the blast radius stops growing while you plan the recovery.
- Assess exactly what's broken: is data actually lost, or is it present but inaccessible/inconsistent because the CODE reading it is now mismatched with the schema? These require very different recoveries: the second is often fixable by restoring compatible code even without touching the data at all.
- Restore user-facing service, even imperfectly, first: if a compatible READ path can be restored (rolling back application code to something that can correctly read the current schema state, even if it's not the originally-intended final version), do that before attempting a full data fix, since users experiencing an outage is usually more costly per minute than users experiencing slightly stale or degraded functionality.
- Data integrity repair: once service is stable, work the actual data recovery: restore from a recent backup and replay changes since (if feasible), run a corrective migration that reconstructs the intended state from whatever source-of-truth data survived, or, in the worst case, accept and clearly communicate a bounded data loss window.
- Customer-facing mitigation: for anything that can't be silently repaired (an order that's genuinely lost, a balance that's genuinely wrong), proactive, honest communication and, where appropriate, a compensating action (a credit, a manual reconciliation) rather than hoping nobody notices.
- Longer-term repair: once the immediate incident is resolved, the actual root-cause fix: what made this migration irreversible in the first place, and what process (a required backward-compatibility review, a mandatory backup-verification step before any destructive migration) would have caught it before it shipped.
Worked example
A migration accidentally dropped a column still being read by a currently-live older app version during a rolling deploy, causing read errors across a fraction of instances. Immediate step: roll forward (not back) to a version of the application that doesn't reference the dropped column at all, restoring service without touching the database. Next: restore the dropped column's data from the most recent backup, replaying any writes that happened between the backup and the drop from a write-ahead log or an application-level audit trail if one exists; if truly nothing survived, this becomes a customer communication and compensation problem, not a technical recovery problem.
Trade-offs and pitfalls
The instinct under pressure is to try to fix everything at once, but attempting a full data-integrity repair WHILE the service is still down usually extends the outage without actually making the data recovery any faster; restoring service first (even in a degraded, "read old code" state) buys the time and stability needed to do the data recovery carefully rather than under the same acute pressure. The costliest mistake in this scenario is usually having no way to restore a compatible read path at all, which is the strongest argument for why backward-compatible migrations matter in the first place, this incident is exactly the failure mode that discipline exists to prevent.
You're performing a blue-green cutover behind a global CDN. How do you switch traffic without serving stale content or poisoning the cache, and what would you check before and after the switch?
Sample Answer
Direct answer
Switching traffic during a blue-green cutover behind a global CDN needs to account for the CDN's OWN cache, which is a separate layer from the origin switch itself: flipping which origin serves requests doesn't automatically clear what the CDN has already cached from the old origin, so you need to explicitly invalidate stale cached content at the moment of cutover, or users can keep seeing old, cached responses even though the origin has switched.
Structured elaboration
- Warm the new origin's cache before cutover: if the CDN caches per-origin, priming commonly-requested paths against the green origin before it starts receiving real traffic avoids a cold-cache latency spike at the moment of cutover.
- CDN invalidation at cutover: for content that's origin-dependent (a page whose HTML or API response differs between blue and green), explicitly purge/invalidate the relevant cache keys at the CDN as part of the cutover step, not after, or users could be served a mix of old cached content and new origin responses inconsistently.
- DNS TTL for the origin switch itself: if the CDN's origin selection is driven by DNS, a short TTL for the cutover window ensures the CDN's edge nodes pick up the new origin promptly; a long, stale TTL from routine operation can mean some edge locations keep hitting the old origin well past when you believe the cutover completed.
- Session affinity: for anything relying on sticky sessions at the CDN or origin level, a user mid-session during cutover could have their session pinned to the OLD origin depending on how affinity is implemented; confirm whether session state is externalized (shared between blue and green) or whether affinity itself needs to be reset as part of cutover.
- What to check before the switch: the green origin is warm and passing health checks directly (bypassing the CDN, hitting it straight) so you're validating the origin itself, not a cached response. What to check after: sample real, CDN-fronted requests from multiple edge locations/regions to confirm they're actually hitting the new origin and getting fresh (not stale-cached) responses, since a purely origin-side health check wouldn't catch a CDN-layer caching problem.
Worked example
A cutover where the green origin's health check passes cleanly directly against the origin, but samples of CDN-fronted requests from three different edge regions ten minutes post-cutover show one region still serving a stale cached response, tracing back to a CDN edge node that hadn't yet honored the DNS TTL change. This is caught specifically by testing THROUGH the CDN from multiple locations, not just testing the origin directly, which is exactly why a pure origin health check isn't sufficient validation for a CDN-fronted cutover.
Trade-offs and pitfalls
The most common mistake is validating only the origin directly and declaring the cutover successful, missing that the CDN layer between users and the origin has its own state (cached content, possibly stale DNS resolution at the edge) that needs its own explicit verification. Aggressive cache invalidation at cutover trades a brief spike in origin load (as the CDN re-fetches everything fresh) for correctness; under-invalidating trades correctness for a smoother load profile, and getting that balance wrong in either direction has a real cost.
You're asked to implement GitOps for deployment at your company. What automation and approval steps do you need to add to the Pull Request workflow to ensure safe production rollouts while maintaining developer velocity?
Sample Answer
Direct answer
Safe production rollouts via GitOps need the PR (pull request) workflow to add exactly two things beyond a normal code-review PR: an automated, VISIBLE preview of the actual deployment effect (not just the manifest diff) and a graduated approval bar that scales with the target environment, while everything that does NOT need to slow down (linting, unit-level manifest validation, non-production environments generally) should stay genuinely fast, since developer velocity is preserved specifically by NOT applying production's rigor uniformly everywhere.
Structured elaboration
Automation added to the PR workflow. Manifest/schema validation and Helm/Kustomize rendering checks on every PR, fast and free, running regardless of target environment. For a PR touching a PRODUCTION overlay specifically: a rendered-diff comment (adapted from ordinary plan-review practice to Kubernetes manifests, showing the actual resulting object diff, not just the raw YAML text diff) and a policy-as-code evaluation (OPA/Rego) against the rendered manifest.
Approval steps added, graduated by environment. Non-production overlays: standard single-reviewer PR approval, no additional gate. Production overlays: CODEOWNERS-scoped approval from a designated group, PLUS the rendered-diff and policy checks above passing as required status checks; this is where the "safe" requirement concentrates its cost, deliberately, rather than being spread evenly across every environment's PRs.
Preserving developer velocity. The KEY design choice: none of the production-specific rigor applies to a developer's DAY-TO-DAY work in dev/staging overlays, which stay fast (standard review, no extra gates); a developer iterating rapidly in a non-production environment experiences essentially the same speed as before GitOps rigor was added anywhere, and only encounters the heavier bar at the SPECIFIC moment (a production promotion PR) where the extra rigor is actually earning its cost.
Post-merge, reconciliation and rollback. Once a production PR merges, the GitOps controller reconciles, and the SAME rollback mechanism available for any other change (Git revert plus reconciliation) is available if the newly-merged change causes a problem, itself a form of safety that does not add ANY friction to the merge process, since it is available after the fact rather than requiring extra pre-merge steps to guarantee.
Worked example
A concrete PR-workflow shape for a service with dev, staging, and production overlays:
| PR touching | Required checks | Approval |
|---|---|---|
overlays/dev/** | Lint, schema validation | 1 standard reviewer |
overlays/staging/** | Lint, schema validation, Helm/Kustomize render check | 1 standard reviewer |
overlays/prod/** | Lint, schema validation, render check, rendered-diff PR comment, OPA policy evaluation | CODEOWNERS-scoped production approver group |
A developer's typical day (iterating in dev, occasionally promoting to staging) experiences the FIRST two rows almost entirely, fast and low-friction; the heavier third row is encountered only at the deliberate moment of promoting to production, which is exactly the point at which the added rigor is actually buying real safety rather than merely adding process overhead to changes that do not need it.
Trade-offs and pitfalls
- Common mistake: applying the SAME heavy gate (rendered-diff review, policy evaluation, elevated approval) uniformly to every environment's PRs "for consistency." This is the single most common way a GitOps adoption ends up SLOWER than the process it replaced without a corresponding safety gain, most of a team's daily PR volume touches non-production environments, and applying production's bar there taxes exactly the changes that need it least.
- A rendered-diff comment that shows raw YAML text differences, rather than the actual resulting Kubernetes object diff, is a common, weaker substitute, the same plan-review-actionability principle applies here as to a Terraform plan: a template change can alter the rendered OUTPUT significantly while the raw template text diff looks small, or vice versa; reviewing the rendered effect, not the template source, is what actually catches what matters.
- CODEOWNERS-scoped production approval only provides real protection if the group's membership is kept current and reviewed periodically; an outdated production-approver group is a structural gap that looks like a safety control while actually being weaker than it appears.
- Post-merge rollback availability (via Git revert plus reconciliation) is a genuine safety net, but it is not a substitute for the pre-merge checks, the same caution about a revert's limits that applies to a Terraform rollback applies here too: a rollback undoes the DECLARED state, but any real-world side effect the bad change already caused (a data write, an external system notified) is not automatically undone by a Git revert alone, which is why the pre-merge gate for production still matters even with a working rollback path available afterward.
What is a canary deployment? Walk through a typical sequence: the initial traffic percentage, what you'd monitor during the canary window, and the triggers you'd use to promote or roll back.
Sample Answer
Direct answer
A canary deployment ships a new version to a small slice of traffic first, watches it closely against the stable version, and only widens exposure if it looks healthy; if it doesn't, you pull the plug on a small fraction of users instead of everyone.
Structured elaboration
- Initial slice: route a small percentage of traffic, often 1-5%, to the new version while the rest continues on the stable version.
- Observe: compare metrics between the canary and the stable baseline over the SAME time window, not the canary against yesterday's numbers, since traffic patterns shift by time of day.
- Decide: if the canary's metrics stay within an acceptable band of the baseline for long enough, promote to a larger percentage; if they degrade, roll back the canary slice.
- Ramp: repeat at increasing percentages (for example 5% -> 25% -> 100%) rather than jumping straight to full traffic, since a problem that only shows up under real production load or a particular traffic mix might not surface at 1%.
- Promote or rollback trigger: could be a manual decision from a dashboard, or automated based on a metric threshold; either way it needs an explicit, pre-agreed criterion, not "it felt fine."
Worked example
A checkout service canaries a payment-processing change at 2% of traffic for 30 minutes. Error rate on the canary stays at 0.15% versus the stable version's 0.12%, well within the agreed 0.5% absolute-difference tolerance, so the team promotes to 25% for another 30 minutes, then to 100%.
Trade-offs and pitfalls
Canary buys you a much smaller blast radius than a straight rollout, but it's slower to reach full deployment and needs enough traffic volume for the canary slice to be statistically meaningful; a low-traffic service at 1% might only get a handful of requests, which isn't enough to detect a real but modest regression. The common mistake is treating a clean canary window as proof of correctness rather than as reduced risk: rare edge cases and slow-building problems (a memory leak, a cache-warming issue) can still slip through a short canary window.
Unlock Full Question Bank
Get access to all Safe Deployment and Rollback Strategies interview questions and detailed answers.
Sign in to ContinueJoin thousands of developers preparing for their dream job.