The on-call engineer followed the runbook to drain the legacy node.
O engenheiro de plantão seguiu o runbook para drenar o nó legado.Aula
Runbooks e procedimentos operacionais
Nível: B2
Objetivo
Escrever, revisar e seguir runbooks e procedimentos operacionais em inglês, estruturando prerequisites, decision points, rollback steps, verification e escalation path; produzir instruções de produção que sejam seguras, verificáveis e auditáveis.
Explicação
Um runbook é um documento passo a passo usado durante uma operação real: deploy, failover, rotação de credenciais, drenagem de tráfego, resposta a incidente. Diferente de um design doc, ele não propõe mudanças — ele executa mudanças. Por isso, a qualidade da linguagem importa menos que a clareza operacional: alguém cansado, de madrugada, em plantão, precisa seguir o runbook sem ambiguidade.
Um runbook maduro segue uma estrutura reconhecível. As seções abaixo aparecem, em alguma ordem, em quase toda organização:
- Title and purpose — o que este runbook faz e em que cenário é usado.
- Owner and last reviewed — quem é dono do documento e quando foi revisado pela última vez. Runbooks vencem.
- Prerequisites — o que precisa ser verdade antes de começar: acesso, aprovação, mudança em janela, versão de ferramenta, estado de saúde do sistema.
- Decision points — pontos em que o operador escolhe entre caminhos diferentes, geralmente com base em uma métrica ou um sintoma.
- Steps — sequência numerada, com o comando exato, o que esperar e o que fazer se a saída não for a esperada.
- Rollback steps — como reverter o runbook, mesmo quando a operação principal está parcialmente concluída.
- Verification — como confirmar que a mudança foi aplicada com sucesso (métrica, log, dashboard, smoke test).
- Escalation path — quem acionar, em que ordem, com qual canal, se um pré-requisito falhar, se uma verificação falhar ou se o rollback não for possível.
A ordem existe por um motivo: o operador precisa saber antes se tem permissão e saúde de sistema para começar (prerequisites), precisa saber durante o que observar e o que considerar aceitável (decision points e verification) e precisa saber o tempo todo quem chamar se algo fugir do script (escalation path). Um runbook sem prerequisites leva a falhas de permissão em produção; um runbook sem rollback leva a incidentes prolongados; um runbook sem verification leva a "deploys silenciosos" que parecem ter funcionado mas não funcionaram.
Frases úteis em B2 para abrir cada seção:
- Purpose: *This runbook drains traffic from the legacy API gateway during a planned cutover.*
- Prerequisites: *Before starting, confirm that you have production write access, that the change ticket CR-4821 is approved, and that the maintenance window is open.*
- Decision point: *If the request error rate is above 0.5%, stop and go to the rollback section. Otherwise, proceed to step 4.*
- Step: *Run the following command: `kubectl drain node-3 --ignore-daemonsets`. Verify that the output contains `node-3 cordoned` before continuing.*
- Verification: *After step 6, the dashboard `payments-latency` should show p99 below 250ms for at least five minutes.*
- Escalation: *If verification fails after two attempts, page the platform on-call and the database owner. Do not attempt a third rollback without sign-off.*
Diferenças de registro também importam. O runbook é um texto imperativo (*drain the node*, *verify the output*), enquanto o postmortem é reflexivo (*we drained*, *the output was*). Misturar os dois registros — escrever *we should drain the node* num runbook — é um sinal clássico de que o documento foi escrito por quem não vai executá-lo.
Por fim, a regra de ouro: um runbook só é confiável depois de ter sido executado em condições reais. Bons times rodam o runbook em ambiente de staging, em modo dry-run, ou pelo menos revisam-no periodicamente com quem está de plantão. Se o seu runbook não foi executado nos últimos seis meses, ele está mentindo para você.
Exemplos
| Inglês | Tradução | Observação |
|---|---|---|
| This runbook drains traffic from the legacy API gateway during a planned cutover. | Este runbook drena o tráfego do API gateway legado durante um cutover planejado. | Purpose em uma frase, com verbo de execução no presente simples. |
| Before starting, confirm that the change ticket CR-4821 is approved and that the maintenance window is open. | Antes de começar, confirme que o ticket de mudança CR-4821 está aprovado e que a janela de manutenção está aberta. | Prerequisites em frase única com 'confirm that'. |
| If the request error rate is above 0.5%, stop and go to the rollback section. Otherwise, proceed to step 4. | Se a taxa de erro de requisições estiver acima de 0,5%, pare e vá para a seção de rollback. Caso contrário, prossiga para o passo 4. | Decision point com condição, ação e ponteiro para outra seção. |
| Run `kubectl drain node-3 --ignore-daemonsets` and verify that the output contains `node-3 cordoned` before continuing. | Execute `kubectl drain node-3 --ignore-daemonsets` e verifique se a saída contém `node-3 cordoned` antes de continuar. | Step com comando literal, saída esperada e 'before continuing'. |
| After step 6, the dashboard `payments-latency` should show p99 below 250ms for at least five minutes. | Após o passo 6, o dashboard `payments-latency` deve mostrar p99 abaixo de 250ms por pelo menos cinco minutos. | Verification com métrica, dashboard e janela de tempo. |
| If verification fails after two attempts, page the platform on-call and the database owner. Do not attempt a third rollback without sign-off. | Se a verificação falhar após duas tentativas, acione o plantão da plataforma e o responsável pelo banco. Não tente um terceiro rollback sem aprovação. | Escalation path com gatilho, lista de pessoas e regra de parada. |
Erros comuns
- Escrever o runbook em tom de postmortem: 'we should drain the node' em vez de 'drain the node'. O leitor do runbook está executando, não debatendo.
- Listar comandos sem saída esperada: 'run the migration' sem dizer o que aparece em caso de sucesso vira suposição em produção.
- Pular prerequisites: começar com 'restart the service' sem verificar janela de manutenção, aprovação de mudança ou estado de saúde leva a falhas caras.
- Tratar rollback como apêndice: rollback precisa estar descrito com o mesmo nível de detalhe dos passos principais, inclusive para o estado parcial.
- Esquecer verification: deploys que 'parecem ter funcionado' são o tipo mais perigoso de incidente. O runbook precisa dizer o que medir e por quanto tempo.
- Escalation path vago: 'escalate if needed' não diz a quem, em que canal, em que ordem e com qual informação. O runbook tem que nomear.
- Não versionar e não datar: um runbook sem 'last reviewed' é um runbook que ninguém confia depois de seis meses. Operadores precisam saber se está atualizado.
Prática guiada
Reescreva o trecho informal abaixo como três seções de um runbook.
Texto informal: `A gente precisa reiniciar o serviço de pagamentos. Antes, tem que ver se a janela tá aberta e se o ticket foi aprovado. Se der erro, chama o Bruno. Se funcionar, olha se a latência caiu.`
Em tom de runbook:
- Prerequisites: *Before starting, confirm that the change ticket CR-5118 is approved, that you are inside the maintenance window (Tuesday 22:00–23:00 UTC), and that the `payments-api` health check is green for the last five minutes.*
- Decision point: *If the health check is red, do not proceed. Escalate to the payments on-call and wait for sign-off.*
- Verification: *After the restart, the dashboard `payments-latency` should show p99 below 250ms for at least ten minutes. If the metric does not return to baseline, follow the rollback steps.*
Repare: prerequisites viraram itens verificáveis (ticket, janela, saúde), o decision point tem ação explícita (não prossiga, escale) e a verification tem métrica com janela de tempo. A frase 'chama o Bruno' virou 'escalate to the payments on-call' — sem nome próprio, mas com papel claro e o canal (on-call) explícito.
Resumo
Runbooks são textos imperativos usados para executar mudanças em produção: drenar tráfego, fazer failover, rotacionar credenciais, responder a um incidente. A estrutura canônica tem oito blocos — purpose, owner, prerequisites, decision points, steps, rollback, verification, escalation — e cada um existe para um erro específico que operadores cometem quando o bloco está faltando. Linguagem de B2 para esse contexto é direta e testável: comandos com saída esperada, decisions com condição e ação, verification com métrica e janela de tempo, escalation com nomes, canais e regra de parada. Um runbook sem prerequisites, rollback, verification e escalation não é seguro para produção, por mais bem escrito que pareça.
Vocabulário
Palavras principais
This procedure is required for any change touching the primary database.
Este procedimento é obrigatório para qualquer alteração no banco principal.The SOP for credential rotation is reviewed every six months.
O SOP de rotação de credenciais é revisado a cada seis meses.Approval from the platform team is a prerequisite for this runbook.
A aprovação do time de plataforma é um pré-requisito para este runbook.Step 4 is a decision point based on the current error rate.
O passo 4 é um decision point baseado na taxa de erro atual.If the error rate stays above 1%, trigger the rollback.
Se a taxa de erro permanecer acima de 1%, dispare o rollback.Verification takes at least ten minutes of stable metrics.
A verificação exige pelo menos dez minutos de métricas estáveis.The escalation path lists the platform on-call first and the database owner second.
O escalation path lista primeiro o plantão da plataforma e em seguida o responsável pelo banco.If verification fails twice, escalate to the platform on-call.
Se a verificação falhar duas vezes, escale para o plantão da plataforma.The on-call engineer has production write access during the maintenance window.
O engenheiro de plantão tem acesso de escrita em produção durante a janela de manutenção.Page the database owner before rolling back the cluster.
Acione o responsável pelo banco antes de reverter o cluster.The maintenance window for production is Tuesday 22:00 to 23:00 UTC.
A janela de manutenção de produção é terça-feira das 22h às 23h UTC.Open a change ticket before running this runbook.
Abra um change ticket antes de executar este runbook.The pre-flight checklist is part of the runbook.
O checklist de pré-execução faz parte do runbook.Rotating a single key has a smaller blast radius than rotating the root key.
Rotacionar uma chave única tem um blast radius menor do que rotacionar a chave raiz.Run the playbook in dry-run mode before the maintenance window.
Execute o playbook em modo dry-run antes da janela de manutenção.Do not roll back a third time without sign-off from the incident commander.
Não faça rollback uma terceira vez sem sign-off do comandante do incidente.It is safe to proceed only when the health check is green for five minutes.
Só é seguro prosseguir quando o health check está verde por cinco minutos.História
História: Runbooks e procedimentos operacionais
Nível: B2
História em inglês
Drafting the runbook
Daniel is a senior platform engineer at a fintech, and his team has been asked to write a runbook for draining a payments node during a planned failover. He starts with the purpose: this runbook moves traffic away from `payments-node-3` so the cluster can be patched. Under owner and last reviewed, he adds himself and a six-month review date, because the previous runbook was so outdated that operators stopped trusting it. The prerequisites include an approved change ticket, an open maintenance window, and a green health check for at least five minutes before starting. He is careful to mark the blast radius as a single node, not the whole cluster, so reviewers know what they are approving.
The dry run
Before publishing the runbook, Daniel schedules a dry run in staging with two operators who have never seen the document. During the dry run, one operator misreads step 3 and runs the drain command without the `--ignore-daemonsets` flag, which fails. Daniel rewrites the step so that the command appears in a code block and the expected output is on the line below, with the word 'expected' in bold. The second operator stops at the decision point and asks whether 0.5% is the right threshold, because their service has a stricter SLO. They agree to lower the threshold to 0.3% and to add a comment in the runbook explaining where the number comes from. Daniel also adds a sign-off step: any rollback during the run requires approval from the incident commander.
A complication in production
Two weeks later, the runbook is executed for real during a Tuesday maintenance window. After step 5, the dashboard `payments-latency` stays at 280ms, which is above the 250ms target written in the verification section. The on-call engineer follows the runbook and goes to the rollback section, as the decision point in step 6 instructs. He re-enables traffic on the stable node, then pages the platform on-call and the database owner, as the escalation path requires. Verification now shows p99 at 180ms for ten minutes, so the runbook owner updates the change ticket with the outcome and closes the incident. The postmortem later finds that the original threshold of 0.5% was correct, but the verification target of 250ms was too tight for this cluster.
Tradução linha por linha
| Inglês | Tradução |
|---|---|
| Daniel is a senior platform engineer at a fintech, and his team has been asked to write a runbook for draining a payments node during a planned failover. | Daniel é engenheiro sênior de plataforma em uma fintech e seu time recebeu a tarefa de escrever um runbook para drenar um nó de pagamentos durante um failover planejado. |
| He starts with the purpose: this runbook moves traffic away from `payments-node-3` so the cluster can be patched. | Ele começa pelo purpose: este runbook move o tráfego para fora de `payments-node-3` para que o cluster possa receber patch. |
| Under owner and last reviewed, he adds himself and a six-month review date, because the previous runbook was so outdated that operators stopped trusting it. | Em owner and last reviewed, ele se adiciona e marca uma revisão em seis meses, porque o runbook anterior estava tão desatualizado que os operadores pararam de confiar nele. |
| The prerequisites include an approved change ticket, an open maintenance window, and a green health check for at least five minutes before starting. | Os prerequisites incluem um change ticket aprovado, uma maintenance window aberta e um health check verde por pelo menos cinco minutos antes de começar. |
| He is careful to mark the blast radius as a single node, not the whole cluster, so reviewers know what they are approving. | Ele tem o cuidado de marcar o blast radius como um único nó, e não o cluster inteiro, para que os revisores saibam o que estão aprovando. |
| Before publishing the runbook, Daniel schedules a dry run in staging with two operators who have never seen the document. | Antes de publicar o runbook, Daniel agenda um dry run em staging com dois operadores que nunca viram o documento. |
| During the dry run, one operator misreads step 3 and runs the drain command without the `--ignore-daemonsets` flag, which fails. | Durante o dry run, um operador interpreta mal o passo 3 e executa o comando de drain sem a flag `--ignore-daemonsets`, o que falha. |
| Daniel rewrites the step so that the command appears in a code block and the expected output is on the line below, with the word 'expected' in bold. | Daniel reescreve o passo para que o comando apareça em um bloco de código e a saída esperada fique na linha de baixo, com a palavra 'expected' em negrito. |
| The second operator stops at the decision point and asks whether 0.5% is the right threshold, because their service has a stricter SLO. | O segundo operador para no decision point e pergunta se 0,5% é o limite certo, porque o serviço deles tem um SLO mais restrito. |
| They agree to lower the threshold to 0.3% and to add a comment in the runbook explaining where the number comes from. | Eles concordam em reduzir o limite para 0,3% e adicionar um comentário no runbook explicando de onde vem o número. |
| Daniel also adds a sign-off step: any rollback during the run requires approval from the incident commander. | Daniel também adiciona um passo de sign-off: qualquer rollback durante a execução exige aprovação do comandante do incidente. |
| Two weeks later, the runbook is executed for real during a Tuesday maintenance window. | Duas semanas depois, o runbook é executado de verdade durante uma maintenance window de terça-feira. |
| After step 5, the dashboard `payments-latency` stays at 280ms, which is above the 250ms target written in the verification section. | Após o passo 5, o dashboard `payments-latency` fica em 280ms, acima do alvo de 250ms escrito na seção de verification. |
| The on-call engineer follows the runbook and goes to the rollback section, as the decision point in step 6 instructs. | O engenheiro de plantão segue o runbook e vai para a seção de rollback, como o decision point do passo 6 instrui. |
| He re-enables traffic on the stable node, then pages the platform on-call and the database owner, as the escalation path requires. | Ele reativa o tráfego no nó estável e em seguida aciona o plantão da plataforma e o responsável pelo banco, como o escalation path exige. |
| Verification now shows p99 at 180ms for ten minutes, so the runbook owner updates the change ticket with the outcome and closes the incident. | A verification agora mostra p99 em 180ms por dez minutos, então o runbook owner atualiza o change ticket com o resultado e encerra o incidente. |
| The postmortem later finds that the original threshold of 0.5% was correct, but the verification target of 250ms was too tight for this cluster. | O postmortem depois descobre que o limite original de 0,5% estava correto, mas o alvo de 250ms na verification era apertado demais para este cluster. |
Notas de vocabulário
- this runbook moves traffic away from `payments-node-3` = Purpose em uma frase, com verbo de execução no presente simples e referência técnica em code span.
- owner and last reviewed = metadado obrigatório em todo runbook; sem isso, operadores não sabem se o documento está atualizado.
- blast radius = extensão do impacto caso a operação dê errado; deve ser marcado no runbook para que o reviewer saiba o tamanho do risco.
- dry run = execução simulada, sem efeito real, para validar o runbook com operadores que nunca viram o documento.
- the expected output is on the line below = forma de reduzir ambiguidade: comando, depois 'expected' em negrito, depois a saída esperada.
- sign-off step = passo explícito de aprovação; impede rollback ou retry sem autorização, especialmente durante incidentes.
- decision point = ponto com condição, ação e ponteiro para outra seção; sem isso, o operador tem que adivinhar.
- escalation path = lista de papéis, canais e ordem de acionamento; substitui 'tell someone if something goes wrong'.
- verification now shows p99 at 180ms for ten minutes = verification combina métrica (p99), alvo (180ms) e janela de tempo (dez minutos) — formato padrão.
Perguntas de compreensão
- What does Daniel's runbook do, in one sentence?
- Which prerequisites must be satisfied before the runbook starts?
- What is the blast radius of this runbook?
- Why did Daniel rewrite step 3 after the dry run?
- What threshold did the team change during the dry run, and to what?
- Why did the on-call engineer stop the production execution and go to rollback?
- Who did the on-call engineer page, and why?
- What did the postmortem find about the original thresholds?
- What did Daniel add after the dry run, besides the lower threshold?
Prática com a história
- Reescreva em tom de runbook: Antes de tudo, vê se a janela tá aberta.
- Classifique a frase: If the dashboard stays red for more than five minutes, escalate to the platform on-call.
- Escreva um verification de uma frase para o runbook do story, mencionando métrica, alvo e janela de tempo.
- Faça uma pergunta de revisão sugerindo um dry run antes da execução em produção.
Prática
Exercícios e teste
A próxima melhoria é transformar esses arquivos em perguntas com resposta no navegador. Por enquanto, esta página já organiza o estudo e permite seguir a aula inteira sem abrir os arquivos manualmente.