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.
What does a good rollback runbook contain: prerequisites, exact commands, verification steps, stakeholder notification, and escalation paths? Sketch one for a production rollback.
Sample Answer
Direct answer
A good rollback runbook is written so someone under pressure, possibly not the person who wrote it, can execute it correctly without having to reconstruct context: prerequisites to check first, the exact commands (not descriptions of commands), how to verify each step worked, who to notify and when, and a clear escalation path if something doesn't go as expected.
Structured elaboration
- Prerequisites: what needs to be true before you start (do you have the necessary access/credentials, is there a database migration involved that needs its own compatibility check first, is there a specific person who needs to approve an emergency rollback for this particular service).
- Exact commands: copy-pasteable, not paraphrased; "roll back the deployment" is not a runbook step,
kubectl rollout undo deployment/checkout-apiis. Include the automation link if the rollback is triggered via a CI/CD job rather than a raw command. - Verification steps: what specifically confirms the rollback worked, both technically (rollout status, pod health) and from a business standpoint (the metric that was degraded has actually recovered), since a rollback that "completes" without the underlying problem resolving means you're not actually done.
- Stakeholder notification: templates, not just "notify stakeholders", a pre-written message for the incident channel, and for customer-facing communication if applicable, so nobody's drafting a message from scratch while also trying to execute a rollback.
- Escalation paths: who to page if the rollback itself fails or if the situation is outside what the runbook covers, with actual names/roles/paging mechanisms, not "escalate as appropriate."
- An emergency-specific section: for the worst case (rollback isn't straightforward, e.g. a migration already ran), a distinct, clearly-labeled set of steps rather than burying emergency guidance inside the normal-case runbook where it's easy to miss under pressure.
Worked example
ROLLBACK RUNBOOK: checkout-api
Prerequisites: confirm no in-flight database migration (check #deploys channel for
migration status); confirm you have kubectl access to the prod cluster.
Steps:
1. kubectl rollout undo deployment/checkout-api
2. kubectl rollout status deployment/checkout-api --timeout=120s
3. Verify: error rate back under 0.5% on the checkout-api dashboard [link]
4. Verify: /healthz returns 200 -- curl -sf https://checkout-api.internal/healthz
Notify: post in #incidents using template [link]; page @checkout-oncall if not already engaged.
Escalate to: @senior-sre-oncall if rollout status doesn't complete within 5 minutes,
or if error rate hasn't recovered within 3 minutes of rollback completing.
Emergency (migration already applied): see EMERGENCY-ROLLBACK.md, do not attempt
a plain code rollback if a schema migration for this release has already run.
Trade-offs and pitfalls
A runbook that's too generic ("roll back the service, verify it's healthy") provides false confidence, since it doesn't actually reduce the cognitive load on someone executing it under pressure, which is the entire point of having one; a runbook that's never been tested (a "dry run" or gameday rehearsal) risks being subtly wrong or outdated exactly when it's needed most. The most valuable, and most often skipped, sections are the exact verification criteria and the escalation path, both of which people tend to assume are obvious and therefore don't bother writing down.
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.
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.
What is a kill-switch feature flag? Sketch how an application would check one at runtime to gracefully disable a failing feature without a redeploy.
Sample Answer
Direct answer
A kill-switch is a feature flag whose sole purpose is an emergency, instant off-switch, evaluated as simply and reliably as possible so it works even under the stressed conditions (a live incident) it's most likely to be needed in; unlike a targeting flag, it typically has no complex rules to evaluate, just a boolean the application checks before executing risky logic.
Structured elaboration and worked example
def is_feature_enabled(flag_name: str, flag_client) -> bool:
# Checks a kill-switch flag at runtime. Fails SAFE (returns False,
# i.e. treats the risky feature as disabled) if the flag can't be
# read, rather than assuming the feature is fine to run.
try:
return flag_client.get_bool(flag_name, default=False)
except Exception:
return False
def process_payment(order, flag_client):
if not is_feature_enabled("new_payment_processor", flag_client):
return legacy_payment_path(order)
return new_payment_processor_path(order)
The application checks the flag BEFORE entering the risky code path, not as an afterthought inside it, so flipping the flag off takes effect on the very next check, no redeploy, no waiting for a rolling restart. The except fallback to False (fail safe, disable the risky path) rather than propagating the exception or defaulting to True is the specific design choice that makes this a SAFETY mechanism rather than just a toggle: if the flag system itself is having a bad day, that shouldn't mean risky code keeps running unchecked.
Trade-offs and pitfalls
A kill-switch needs to be evaluated with minimal dependencies and minimal latency, ideally from a local in-memory cache rather than a live network call, precisely because the moment it's needed most (an active incident) is also the moment the rest of the system's infrastructure is most likely to be under stress or partially degraded. The common mistake is building a kill-switch with the same rich targeting-rule evaluation logic as an ordinary feature flag; the extra complexity is exactly what you don't want in the one flag type whose entire job is working reliably in a crisis.
Tell me about a time you had to trigger a production rollback. What tipped you off, how did you execute it, and what did you change afterward to prevent recurrence?
Sample Answer
Direct answer
A strong answer here follows STAR: what tipped you off that something was wrong, what you actually did to execute the rollback, and what changed afterward so the same failure mode doesn't recur. The interviewer is listening for concrete detection signals and concrete actions, not a vague "we noticed issues and rolled back."
Structured elaboration
- Situation/Task: name the service, the scale (traffic volume matters for how fast things degraded), and what the deploy changed.
- Action - detection: was it a dashboard alert, a customer report, a synthetic check? Specificity here (a named metric crossing a named threshold) is what separates a real story from a generic one.
- Action - execution: what commands or automation did you actually run? Redeploy previous image tag, flip a feature flag, revert a config? Did you have to coordinate a database rollback too, or was code-only sufficient?
- Action - safety checks: how did you confirm the rollback itself was safe before running it (was there a schema dependency you had to check first)?
- Result: how long did it take from detection to resolution, and what was the actual customer impact?
- Follow-up: what changed afterward: a new automated rollback trigger, a canary gate that would have caught it earlier, a runbook that didn't exist before?
Worked example
"We shipped a change to our checkout service that introduced a null-pointer path under a rare cart configuration. Fifteen minutes after full rollout, our error-rate alert fired at 3% (baseline 0.1%). I confirmed via the dashboard the spike started at the deploy timestamp, then ran our rollback script to redeploy the previous image tag, which took about ninety seconds including health-check verification. Error rate returned to baseline within two minutes of the redeploy completing. Afterward we added that cart configuration as an explicit test case and lowered our canary's automated error-rate threshold so a similar regression would be caught at 1% traffic instead of 100%."
Trade-offs and pitfalls
A common weak answer stops at "we rolled back and it was fixed" without naming a detection signal or a concrete command, which reads as secondhand rather than lived experience. Another common gap is skipping the "what changed afterward" beat entirely, which is often what the interviewer is most interested in, since it signals whether you learn from incidents systemically or just fight fires one at a time.
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.