📁 Sangam Dhakal - Portfolio v2.0 - Netscape Navigator 4.0
_
□
×

๐Ÿ“š Interview question

What makes a good runbook? Your on-call engineer gets paged at 3 am for an alert on a .NET service they've never touched. What should the runbook linked from that alert contain (symptoms, checks, safe actions, escalation), how do you write it so a tired stranger can follow it, and how do you stop runbooks going stale?

Covers runbook design: one runbook per alert, the structure (impact, triage checks, safe mitigations, verification, escalation), exact commands and queries, writing for a stranger under stress, automation, and keeping runbooks current through drills and post-incident updates.

Mid-Level Theory Intermediate incident-response kql on-call production runbooks site-reliability

๐ŸŽฏ Key points

  • One runbook per alert (or per alert family with an anchor per alert), linked from the alert itself (runbook_url), not a wiki to search
  • Structure: what fired and the user impact (which sets severity) → first checks → safe mitigations → how to verify → escalation
  • Copy-pasteable commands and queries (KQL, kubectl, az, dotnet-counters) with expected output
  • Safe actions first and clearly labelled: rollback, flag off, scale out, restart one instance; risky actions need a second person
  • Written for a stranger under stress: numbered steps, decision points, no assumed context, links to dashboards
  • Escalation: who owns it, how to reach them, when to declare a higher severity
  • Kept current: owner and last-verified date (90 days for Tier 1), updated after every incident, exercised in game days
  • Automate repeated safe steps: scripts, Azure Automation runbooks or action-group-triggered remediation, logged to the incident channel

โฑ 30-second answer

A good runbook is one page per alert, linked from the alert, that lets someone who has never seen the service act safely in minutes. It says what fired and what users feel, gives numbered checks with copy-pasteable KQL, kubectl and dotnet-counters commands and what normal looks like, lists safe mitigations first (roll back, turn off a kill switch, scale out, restart one instance) with how to verify each worked, and says who to escalate to and when.

It's written for a tired stranger: decisions as if/then, no tribal knowledge, links to the dashboard. It stays current because it has an owner and a last-verified date, every incident ends with "update the runbook", and game days exercise it. The trade-off: runbooks cost upkeep, so steps you repeat often should become automation.

๐Ÿ—ฃ Full answer (senior)

How I would answer this in an interview

"I write a runbook for the person who gets paged at 3 am and has never touched this service. That changes everything about it. It has to be reachable in one click, so every alert carries a runbook_url pointing at the runbook for that alert, not a wiki home page. It starts with what fired in plain words and what users are probably feeling, so the responder can judge severity straight away. Then numbered checks: open this dashboard, run this KQL query, and here's what normal looks like versus broken. Every command is copy-pasteable, with the cluster and namespace filled in.

Then the safe actions, in order of how safe they are: roll back the last deployment if it was in the last two hours, turn off the kill switch for the dependency that's failing, scale out, restart one instance. Each action says how to verify it worked: 'the error ratio on the dashboard should drop below 1% within five minutes'. Anything risky, like failing over the database or purging a queue, is marked as needing a second person or the owning team. And it ends with escalation: who owns the service, how to reach them, and when to raise the severity. For example, at [company] we [rewrote our runbooks into this one-alert-one-page format after an incident where on-call spent 25 minutes finding the right page], and [median time to mitigate on those alerts dropped from about 40 to about 15 minutes].

The hard part is keeping them true. Every runbook has an owner and a 'last verified' date; every postmortem has a standing action 'did the runbook help, and what changed?'; and we run game days where someone follows a runbook in staging without help. When a step is repeated every time, like 'restart the stuck consumer', it becomes a button or a script. The mistake I see is runbooks that describe the architecture instead of telling you what to do."


The structure I use

Section Contents Example
What fired Alert name, plain-language meaning, threshold "Checkout 5xx burning the 99.9% budget at 14ร—"
Impact What users see, who is affected, likely severity "Some customers can't pay; Sev 2 unless > 10% failing"
First checks Numbered steps, links, queries, expected results "1. Dashboard: is it one region or all? 2. Recent deploys?"
Safe mitigations Ordered by safety, each with verify step Roll back โ†’ flag off โ†’ scale out โ†’ restart one pod
Risky actions Need a second person or owner approval Database failover, purge dead-letter queue
Escalation Owner team, contact, when to raise severity "No improvement in 20 min โ†’ page payments on-call, declare Sev 1"
Background Links to architecture, dependencies, past incidents Kept short, at the bottom
Metadata Owner, last verified date, related alerts "Owner: checkout team; verified 2026-10-03"

Good runbook vs bad runbook

Good Bad
One alert, one page, linked from the alert A 40-page wiki for the whole service
"Run this query; more than 50 rows means X" "Check the logs"
Actions in order of safety, with how to verify A list of things that might be wrong
Escalation with names and a time limit "Contact the team"
Verified in the last 6 months Mentions servers that were decommissioned

Production example

After an incident where on-call spent 25 minutes finding the right page and then ran a stale command against a decommissioned cluster, the team moved to one runbook per alert in the service repo, with runbook_url required by CI on every alert rule. Over the next quarter, median time to mitigate on paged alerts went from about 40 minutes to about 15, and two game days found and fixed six broken steps before a real incident did.

๐Ÿ” What the interviewer is checking

Checks the candidate can write operational documentation that actually works during an incident and knows how to keep it accurate.

Green flags

  • One runbook per alert, linked from the alert
  • Concrete commands, queries and expected results
  • Safe mitigations ordered and verified; risky actions gated
  • Clear escalation with time boxes
  • A real mechanism for keeping runbooks current (owner, drills, postmortem updates)

Red flags

  • Runbook = architecture description
  • "Check the logs" level of detail
  • No idea how runbooks stay up to date

๐Ÿ“š Learn in depth

1. Why runbooks exist

During an incident, people's working memory shrinks: they're woken up, stressed and often unfamiliar with the service. A runbook moves knowledge from the heads of the people who built the system into a document that works without them. It also makes response consistent: the same alert gets the same first steps no matter who is on call.

alert fires โ”€โ–บ page with runbook_url โ”€โ–บ runbook
                                          โ”‚
                    โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
                    โ–ผ                     โ–ผ                    โ–ผ
            impact + severity      checks (decision tree)    escalation
                                          โ”‚
                                 safe mitigation โ”€โ–บ verify โ”€โ–บ still broken? โ”€โ–บ next action / escalate

2. Runbook vs playbook vs postmortem

Document Scope When written Used when
Runbook One alert or one operational task Before incidents During response, step by step
Playbook A class of incident (e.g. "region outage", "data breach") with roles and comms Before incidents Coordinating a large incident
Postmortem One past incident After it Learning, actions

3. Writing for a stranger under stress

  • Numbered steps and if/then decisions, not paragraphs.
  • Exact commands with real names: kubectl -n checkout rollout undo deploy/checkout-api, not "roll it back".
  • Expected output: what normal looks like, so the responder can tell.
  • Time boxes: "if no improvement in 10 minutes, escalate".
  • No secrets in the runbook; link to where credentials come from (Key Vault, PIM elevation).
  • Plain language; define acronyms once.

4. Safe versus risky actions

A safe action is reversible, scoped and well understood: rolling back to the previous image, disabling a feature flag, scaling out, restarting one instance. Risky actions are irreversible or broad: deleting messages, failing over a database (possible data loss within the replication lag), running a data fix. Runbooks should make that difference visible, require a second person for risky ones, and say what to capture first (a dump, the dead-letter contents) before destroying evidence with a restart.

5. Automation: from runbook to button

written step โ”€โ–บ copy-paste script in the runbook โ”€โ–บ parameterised script in the repo
            โ”€โ–บ one-click action (Azure Automation runbook, pipeline job, chat-ops) โ”€โ–บ auto-remediation

Automate steps that are frequent, well understood and safe. Keep a human decision where judgement matters. Every automated action should log what it did into the incident channel.

6. Keeping runbooks true

  • Store them next to the code (markdown in the service repo) so changes to the service and the runbook land in the same pull request.
  • Owner and last-verified date on every runbook; a report flags anything older than 6 months.
  • Postmortem template includes "was the runbook used, was it right, what changed?"
  • Game days: someone who didn't write it follows it in staging, alone.
  • CI checks that every alert rule has a runbook_url that resolves to an existing file.

Try it yourself

  1. Pick your noisiest alert and write its runbook in the structure above; time how long a colleague takes to follow it in staging.
  2. Add a CI check that fails if an alert rule has no runbook link.
  3. Turn one repeated manual step into a script and link it from the runbook.
  4. Run a 30-minute game day: break a dependency in staging and have someone use only the runbook.
  5. List your runbooks with their last-verified dates and count how many are older than six months.

๐Ÿ’ป Code

A runbook template with copy-pasteable checks, and a small xUnit test that keeps runbooks honest in CI.

# Runbook: CheckoutApiBudgetBurnFast

**Owner:** checkout team ยท **Last verified:** 2026-10-03 ยท **Severity:** Sev 2 (Sev 1 if > 10% of checkouts fail)

## What fired
Checkout 5xx ratio is burning the 99.9% monthly error budget at 14ร— (1 h and 5 m windows).

## Impact
Some customers can't complete payment. Check the dashboard for the percentage failing.

## First checks (10 minutes max)
1. Open the [checkout dashboard](https://grafana.example.internal/d/checkout). One region or all?
2. Recent changes? `az monitor activity-log list --resource-group rg-checkout-aue --offset 2h -o table`
3. Which dependency? Run the query below. Normal: no dependency above 1% failures.

## Safe mitigations (in this order)
| # | Action | Command | Verify |
|---|---|---|---|
| 1 | Deploy in last 2 h? Roll back | `kubectl -n checkout rollout undo deployment/checkout-api` | Error ratio < 1% within 5 min |
| 2 | Pricing failing? Kill switch | Set `PricingLive` = off in App Configuration (30 s to apply) | Pricing dependency calls stop |
| 3 | CPU or ThreadPool saturated? Scale out | `kubectl -n checkout scale deployment/checkout-api --replicas=12` | p95 < 500 ms |

## Needs a second person
- Payment provider failover (contact payments on-call first).

## Escalation
No improvement after 20 minutes, or > 10% failing: declare Sev 1, page payments on-call via PagerDuty "payments-primary".
// Failing dependencies for checkout in the last 30 minutes
dependencies
| where timestamp > ago(30m) and cloud_RoleName == "checkout-api"
| summarize total = count(), failed = countif(success == false), p95 = percentile(duration, 95) by target, type
| extend failPct = round(100.0 * failed / total, 2)
| order by failPct desc
// RunbookTests.cs โ€” fails CI when a runbook is missing required sections or hasn't been verified recently.
namespace Ops.Tests;

using System.Globalization;
using System.Text.RegularExpressions;
using Xunit;

public sealed partial class RunbookTests
{
    private const int MaxAgeDays = 90; // Tier 1 policy; use 180 for lower tiers
    private static readonly string[] RequiredSections = ["## What fired", "## Impact", "## First checks", "## Safe mitigations", "## Escalation"];

    public static TheoryData<string> Runbooks()
    {
        var data = new TheoryData<string>();
        foreach (var path in Directory.EnumerateFiles(Path.Combine(AppContext.BaseDirectory, "runbooks"), "*.md"))
            data.Add(path);
        return data;
    }

    [Theory]
    [MemberData(nameof(Runbooks))]
    public void Runbook_has_required_sections_and_is_recently_verified(string path)
    {
        var text = File.ReadAllText(path);

        foreach (var section in RequiredSections)
            Assert.True(text.Contains(section, StringComparison.Ordinal), $"{Path.GetFileName(path)} is missing '{section}'");

        var match = LastVerified().Match(text);
        Assert.True(match.Success, $"{Path.GetFileName(path)} has no 'Last verified' date");

        var verified = DateOnly.ParseExact(match.Groups[1].Value, "yyyy-MM-dd", CultureInfo.InvariantCulture);
        var age = DateOnly.FromDateTime(DateTime.UtcNow).DayNumber - verified.DayNumber;
        Assert.True(age <= MaxAgeDays, $"{Path.GetFileName(path)} was last verified {age} days ago");
    }

    [GeneratedRegex(@"\*\*Last verified:\*\*\s*(\d{4}-\d{2}-\d{2})")]
    private static partial Regex LastVerified();
}

โš  Common mistakes

  • Mistake: One big wiki page for the whole service. Why it is wrong: the responder has to search and read under stress. Instead: one runbook per alert, linked from the alert.
  • Mistake: "Check the logs" as a step. Why it is wrong: it gives no query, no place and no idea what bad looks like. Instead: exact queries and commands with expected output.
  • Mistake: Listing possible causes instead of actions. Why it is wrong: the responder needs to mitigate first, not diagnose the design. Instead: safe mitigations in order, each with a verify step.
  • Mistake: Mixing safe and destructive actions without labels. Why it is wrong: a tired person purges a queue or fails over a database and causes data loss. Instead: mark risky actions, require a second person, capture evidence first.
  • Mistake: No escalation path or time box. Why it is wrong: on-call struggles alone for an hour. Instead: named owner, contact method and "escalate after N minutes".
  • Mistake: Runbooks in a separate wiki nobody updates. Why it is wrong: they drift from the system and give wrong commands. Instead: keep them in the service repo, owner and last-verified date, update after every incident.
  • Mistake: Putting credentials or connection strings in the runbook. Why it is wrong: runbooks are widely readable; secrets leak. Instead: link to Key Vault or PIM elevation steps.
  • Mistake: Never testing the runbook. Why it is wrong: broken steps are discovered during a real outage. Instead: game days where someone else follows it in staging.

๐Ÿ› Senior insight: trade-offs

A runbook is a product for on-call, and I measure it like one: time from page to first mitigation, how often the runbook was used, and how often it was wrong. A senior engineer treats "the runbook didn't help" as an incident finding with an owner, not a shrug. The other senior instinct is knowing when a runbook is the wrong fix: if an alert's runbook always says "restart the consumer", the real fix is to automate the restart or fix the bug, and if an alert has no meaningful action, it shouldn't page at all.

Two practical choices. Granularity: one runbook per alert is the default, but closely related alerts (the fast and slow burn-rate alerts for the same SLO, say) can share one runbook with an anchor per alert, which halves upkeep without making the responder search. Verification cadence: I re-verify Tier 1 runbooks every 90 days and others every 180, because cloud resources, CLIs and dashboards change faster than people expect. Verification methods trade cost for confidence: a desk review is cheap but misses broken commands; a staging game day finds real breakage but costs an afternoon; running the read-only checks automatically in CI catches dead links and renamed resources for free.

Option When it fits Cost When not to
Written runbook Judgement needed, varied causes Upkeep, drills Step is the same every time
Scripted step linked from runbook (bash, PowerShell, az script in the repo) Repeated, safe, parameterised steps Script maintenance Rare, risky actions needing judgement
One-click action (Azure Automation runbook, pipeline job, chat-ops command) Frequent safe actions on-call takes often Permissions design, audit Destructive operations
Auto-remediation (alert action group โ†’ Automation / Logic App / function) Frequent, well understood, reversible Can hide recurring bugs; must log what it did Anything destructive or poorly understood
Delete the alert No action possible or needed None It's the only signal for real user impact

๐Ÿ”— Follow-ups the interviewer may ask

  1. When: Candidate mentions linking runbooks from alerts. Why: Checks they know what makes an alert worth a runbook in the first place.
    How to answer

    Alert on symptoms users feel, such as the request error-rate or latency SLI, failed synthetic journeys or orders per minute dropping, because causes like CPU at 80% often hurt nobody and miss failures with no resource signal at all. The best symptom alert is SLO burn rate: how fast you are spending the error budget. With a 99.9% SLO, a 14.4ร— burn over 1 hour (confirmed over 5 minutes) spends 2% of a 30-day budget and pages; 6ร— over 6 hours pages; slower burns raise a ticket.

    Every alert needs who gets paged (the owning team's rotation), the threshold and window, a severity that decides page versus ticket, a dashboard link and a runbook with the first mitigation steps. Cause metrics stay on dashboards for diagnosis. The trade-off: fewer pages means a slightly later warning for slow-building problems, which tickets cover.

  2. When: Candidate lists rollback, flags or scaling as runbook actions. Why: Checks they can choose the right mitigation, which is the core of a runbook.
    How to answer

    Every minute of an outage costs customers, revenue and trust โ€” for a busy checkout that can be thousands of dollars a minute โ€” while the root cause can be found later from preserved telemetry. So responders ask "what changed?" and reach for the fastest, safest, reversible lever: roll back the release (an App Service slot swap or a previous container image), turn off the feature flag, scale out if it's genuinely capacity, fail over to Australia Southeast if a region is impaired, or shed load with rate limiting to protect the critical path.

    Good mitigation is rehearsed (a rollback you've never practised is a new risk), done one change at a time and verified against the SLIs. The trade-off is speed versus evidence: grab the evidence first when it costs seconds (a memory dump, a log export, a note of the deploy id), because a restart or rollback can destroy what explains the cause โ€” but never delay mitigation by minutes to do it.

  3. When: Candidate mentions turning off a feature flag in a runbook. Why: Checks they understand kill switches, a common runbook action, and their propagation delay.
    How to answer

    A feature flag lets you change behaviour without a deploy, which makes it one of the fastest mitigations you have. A kill switch is a long-lived ops flag around a risky dependency or expensive feature: when it misbehaves you turn it off in seconds instead of rolling back. A gradual rollout uses percentage or targeting filters (1% โ†’ 10% โ†’ 50% โ†’ 100%) while you watch error and latency SLOs, so a bad change hurts a few users and is switched off, not rolled back.

    In .NET I use Microsoft.FeatureManagement with Azure App Configuration, a refresh interval of about 30 seconds and a safe default if the store is unreachable. Flag changes are audited and annotated on dashboards. The trade-off is flag debt: every flag doubles code paths, so release flags get an owner and an expiry date.

๐Ÿ›  Real-world problems: how you handle them

A stale runbook that sent on-call to a decommissioned cluster
Situation
A checkout platform of [8] .NET services on AKS in Australia East. Runbooks lived in a wiki last updated [over a year] earlier, after a migration from [an older cluster].
Signals
A Sev 2 checkout burn-rate page at [2:40 am]. The alert linked to the wiki home page. On-call took [25 minutes] to find the checkout page, then ran a rollback command that failed because the cluster name was the old one. Customer complaints reached support before mitigation.
Investigation
In the postmortem we replayed the response from the incident channel timestamps: [25 minutes] finding the runbook, [15 minutes] on a stale command, [10 minutes] waiting for the owning team. An audit of [42] runbooks found [19] with wrong cluster names, dead dashboard links or no escalation contact.
Resolution
Immediate: fixed the checkout runbook and the commands. Long term: moved runbooks into each service repo, one per alert, required `runbook_url` on every alert rule, and added owner and last-verified metadata with a CI test.
Prevention
Postmortem template asks whether the runbook helped; quarterly game days where someone outside the team follows a runbook in staging; a report of runbooks older than 180 days goes to team leads; frequently repeated steps turned into scripts.

How to tell it (STAR)

**S:** At [company] our on-call engineer spent [25 minutes] finding a runbook at 3 am and then ran a command against a cluster we'd decommissioned, so a checkout incident lasted [nearly an hour]. **T:** I [took the postmortem action / volunteered] to fix how we wrote and maintained runbooks. **A:** I proposed one runbook per alert stored in the service repo, with a standard structure: what fired, impact, numbered checks with KQL and kubectl commands, safe mitigations with verify steps, and escalation with a time limit. I added a CI test requiring sections and a recent last-verified date, made `runbook_url` mandatory on alert rules, and ran game days where someone else followed each runbook. **R:** The audit and game days fixed [19] broken runbooks, and median time to mitigate for paged alerts went from [about 40] to [about 15] minutes over the next quarter.

โ†ฉ Usually asked after

More in Production Tools

Last updated 23 Nov 2026.

๐ŸŒ Sangam's Webring

โช Previous ๐Ÿ  Main Next โฉ
๐Ÿ’ฌ Chat with me