Runbooks

A runbook says WHEN (a trigger) and THEN (actions in order). KeelPilot runs it on its own, with guardrails so it does not run too often, an optional scope of clusters and namespaces, and an owner or admin approval before high-impact actions.

Before you start

  • The Pro or Enterprise plan (the trial includes it). On Free the screen answers “This feature is not included in your current plan (pro_monitoring)”. See Plans & limits.
  • In your access profile, the Runbooks section. Creating, running, approving or rejecting needs a role that is not read-only; simulating does not.
  • Running a runbook by hand (or asking the Copilot to) and approving a pending step need write access to every connection its steps touch; otherwise you get a 403. Notify, webhook and wait steps are exempt. Automatic runs (triggers) have no user: Kubernetes actions run with the permissions of whoever created the runbook, so that person needs write access to the cluster.
  • Ejecutar comando SSM and Invocar Lambda need the “Advanced operations” level on the AWS role of the connection (see Connect AWS).

1. Create a runbook

The Runbooks screen is shown in Spanish, also with the interface in English, except some help texts.

  1. 1Go to Intelligence → Runbooks. The tabs are Runbooks (N), Ejecuciones recientes and Suggested (N).
    Runbooks screen with the Runbooks, Recent executions and Suggested tabs
  2. 2Click Crear Runbook and fill in Nombre and Descripción.
    Create runbook form with name, description, trigger, actions, guardrails and scope
  3. 3In Trigger (CUANDO) choose one of the 8 triggers of the table below and its filters.
  4. 4In Acciones (ENTONCES) — en orden click the actions you want to add; they run one after the other.
  5. 5In Guardrails set Cooldown (minutos) (5 by default) and Máx ejecuciones/hora (10 by default).
  6. 6Optionally, in Scope (optional) write the Allowed clusters and Allowed namespaces, comma separated (up to 50 each).
  7. 7Click Crear Runbook. If the trigger is Webhook, a dialog shows the URL and the secret: save the secret, it is not shown again.
Trigger (as shown)Fires whenFilters
Alerta disparadaAn alert firesSource, severity and a resource regex
Anomalía detectadaAIOps detects an anomalyMetric namespace and severity
Breach de SLOAn SLO is at risk or breachedSLO ID and status (En riesgo / Violado)
Spike de costoCost rises above a percentageThreshold % and service
ProgramadoOn a scheduleEvery 5, 15 or 30 minutes, every hour, or daily at 08:00 or 20:00 (UTC)
ManualOnly when you run it from the page—
IncidenteAn incident is created or changes statusWhen created or when its status changes, Any severity, Any status
WebhookYour system sends a signed POSTOwn URL and secret per runbook
Action (as shown)What it does
Reiniciar deploymentRestarts an ECS service or a Kubernetes deployment
Escalar servicioChanges the desired count of an ECS service or a deployment
Ejecutar comando SSMRuns an SSM document (for example AWS-RunShellScript) on EC2 instances
Notificar canalSends a message to a notification channel
Llamar webhookCalls a URL
Invocar LambdaInvokes a Lambda function
EsperarWaits a number of seconds
AprobaciónStops until someone approves
Patch (kubectl)Patches a deployment, statefulset, daemonset, service, configmap, hpa, ingress, cronjob or node (strategic, merge or json, up to 8 KB)
Cordon de nodoMarks a node unschedulable; with Uncordon it enables it again
Drain de nodoDrains a node (timeout, pods with emptyDir, force pods without a controller, accept missing images)
Comando kubectlRuns a kubectl command validated with the same policy as the kubectl console of the connection

Runbooks created from Cost Optimization with approval can also have the step “Cambiar tipo de EC2 (apaga la instancia)”. It cannot be added by hand.

2. Approval of high-impact actions

If the runbook has Drain de nodo, Patch (kubectl) or a kubectl delete, drain or patch, the form warns: “There are high-impact actions (drain, patch or delete): every real run waits for an owner or admin to approve it.” KeelPilot adds an approval step before them if you did not put one. A simulation does not get that automatic step, but it does stop at an Aprobación step you added yourself.
  1. 1Open Ejecuciones recientes. A paused run shows Esperando aprobación.
    Recent executions with a run awaiting approval, highlighted, and the Approve pending step and Reject buttons
  2. 2Expand it to see each step with its status and error, and click Aprobar or Rechazar. Rejecting runs none of the steps.

A common Aprobación step, in a runbook without high-impact actions, can be approved by anyone whose role is not read-only. Owner or admin is required only when the run has drain, patch or delete: if someone else tries, KeelPilot refuses the approval. When the run was requested from the Copilot and requires a second person, whoever requested it cannot approve it.

3. Run, simulate and review

  • Each runbook in the list has Simular (dry-run), Ejecutar manualmente, Historial and Eliminar. A simulation goes through the steps without applying them and ends with “Simulación completada exitosamente”.
    Runbook list with the row actions highlighted: enable, dry-run, run manually, History and Delete
  • Historial opens the runs of that runbook: start time, N/M pasos and status of each step. Run status: running, completed, failed, cancelled or Esperando aprobación.
  • With a scope, the list shows “Scope: …”. Kubernetes actions outside it are rejected before running; with namespaces set, node cordon and drain are rejected.

4. Webhook trigger

Each Webhook runbook has its own URL (/api/runbook-webhooks/<id> on your KeelPilot) and secret. Sign each POST with HMAC-SHA256 of <timestamp>.<body> and send the X-Keelpilot-Timestamp (unix seconds) and X-Keelpilot-Signature: sha256=<hex> headers. For example:

TS=$(date +%s)
BODY='{"motivo":"deploy"}'
SIG=$(printf '%s.%s' "$TS" "$BODY" | openssl dgst -sha256 -hmac "$SECRETO" | sed 's/^.* //')
curl -X POST "$URL_DEL_RUNBOOK" \
  -H "X-Keelpilot-Timestamp: $TS" \
  -H "X-Keelpilot-Signature: sha256=$SIG" \
  --data "$BODY"
  • 202: accepted, the runbook is running.
  • 401: invalid signature or unknown runbook, or the timestamp is outside the 5-minute window.
  • 409: the runbook is disabled. 429: it is in cooldown or reached its maximum per hour.
  • Limits: 60 requests per minute and a body of up to 64 KB.

5. Suggested runbooks

Suggested (N) lists incidents that happened 3 or more times in the last 30 days. Review draft opens a draft in the editor: it is created disabled and you enable it after reviewing it. Dismiss hides the suggestion until the incident happens twice as often. The same suggestion appears inside the incident, where Draft with AI writes it with AI (see AIOps).

Suggested runbooks for repeated incidents with Review draft highlighted

How to check it works

  • Simular (dry-run) ends with “Simulación completada exitosamente”.
  • After a real trigger, the run appears in Ejecuciones recientes with N/M pasos and its status.
  • For a Webhook runbook, a signed POST answers 202.

Troubleshooting

“This execution has high-impact actions (drain, patch or delete): only an owner or admin can approve it.”

Cause: Someone without the owner or admin role tried to approve.

Fix: Ask an owner or admin of the organization to approve it.

“The connection's AWS role is missing the ssm:SendCommand permission, which belongs to "Advanced operations"…” (or lambda:InvokeFunction).

Cause: The AWS role of the connection does not have the Advanced operations level.

Fix: Update the KeelPilotAccessRole stack with HabilitarOperacionesAvanzadas=Yes.

“The runbook's creator has no write access to cluster …”.

Cause: Kubernetes actions run with the permissions of whoever created the runbook.

Fix: Give that person write access to the cluster, or have someone with access create the runbook.

Running or approving a runbook answers 403 (read-only access to the connection).

Cause: Your profile or the Settings permission for a connection used by its steps is Solo lectura or Ninguno.

Fix: Ask an owner or admin for Escritura on that connection, or have someone who has it run or approve the runbook.

“Outside the runbook scope: cluster … is not among the allowed ones”.

Cause: The action points to a cluster or namespace not listed in Scope.

Fix: Add it to the scope or fix the action.

“Drain cancelled: N pod(s) use images that are no longer in the registry…”.

Cause: Those pods could not start again on another node.

Fix: Fix the images, or tick Accept images missing from the registry on the action if you accept it.

The webhook answers 401 “The signature timestamp is outside the 5-minute window.”

Cause: The clock of the system that sends it is off, or the request was replayed.

Fix: Sync the clock and sign each request at the moment you send it.