Script icon
Docker icon
If icon
SlackIncomingWebhook icon
Log icon
Return icon
Schedule icon

ChaosBlade Experiment Fault Injection State Sentinel

Audits ChaosBlade operator metrics to detect runaway chaos fault injections, experiment execution errors, and rollback failures.

Categories
CloudInfrastructure

Automates continuous blast radius and safety boundary surveillance for ChaosBlade cloud-native chaos engineering operators.

How it works

  1. A schedule trigger executes the ChaosBlade resilience audit workflow every 15 minutes.
  2. The Python task queries the ChaosBlade operator Prometheus metrics endpoint on port 9526.
  3. The script extracts active injection totals, execution error counters, and target probe responsiveness states.
  4. An evaluation gate determines whether runaway fault counts, unhandled errors, or unresponsive probes breach safety policies.
  5. When chaos safety limits are breached, a high-priority Slack incident alert is dispatched to the Resilience team.
  6. When chaos experiments run within designated blast radius limits and revert cleanly, nominal telemetry is logged.
  7. A structured JSON audit manifest is emitted for resilience governance, compliance auditing, and experiment archives.

Architecture diagram

graph TD
    Trigger[Schedule Trigger: 15m] --> ScanMetrics[Python Script: Scrape ChaosBlade Metrics]
    ScanMetrics --> EvalBreach{Errors > 1 OR Injections > Limit OR Probe Dead?}
    EvalBreach -- Yes --> SlackAlert[Slack: High-Urgency Resilience Alert]
    EvalBreach -- No --> LogNominal[Log: Nominal ChaosBlade State]
    SlackAlert --> EmitManifest[Debug Return: Chaos Audit Manifest]
    LogNominal --> EmitManifest

Architecture components

  • Trigger: Automated schedule polling at 15-minute recurring intervals.
  • Script Task: Scrapes ChaosBlade operator Prometheus metrics endpoints using Docker container runners.
  • Decision Gate: Evaluates whether active fault injections exceed safe limits or probe cleanups hang.
  • Notification Task: Dispatches structured Slack alerts with experiment ID and safety violation metrics.
  • Audit Manifest: Emits JSON execution payloads containing chaos experiment health and timestamps.

Key capabilities

  • Continuous surveillance of ChaosBlade ChaosExperiment CRDs, sidecar probes, and injected network/CPU stress.
  • Early warning detection for failed fault rollback hooks that leave production pods in degraded states.
  • Automated tracking of concurrent active chaos experiments preventing catastrophic blast radius overlap.
  • Zero host dependency execution via isolated containerized Python runners.

What you get

  • Real-time visibility into active chaos engineering experiments and cluster resilience posture.
  • Proactive safety guardrails preventing unintentional outages caused by runaway fault injection jobs.
  • Standardized audit manifests containing exact injection counts, error totals, and execution timestamps.
  • Zero-overhead deployment compatible with ChaosBlade Operator and ChaosBlade CLI agent daemonsets.

Who it's for

  • Resilience and chaos engineering practitioners running automated GameDays in Kubernetes environments.
  • Site Reliability Engineers safeguarding production clusters from runaway chaos experiment failures.
  • Platform architects enforcing blast radius guardrails across multi-tenant development clusters.
  • Security and compliance officers auditing controlled stress testing and fault injection procedures.

Why orchestrate this with Kestra

  • Serverless Docker Isolation: Executes telemetry scraping in ephemeral Docker environments without persistent workers.
  • Centralized Secrets Governance: Protects sensitive Slack webhooks using encrypted namespace secrets.
  • Declarative YAML Workflows: Manages chaos safety guardrails as versioned code in Git repositories.
  • Comprehensive Audit History: Preserves historical chaos testing metrics in searchable Kestra execution logs.

Use cases

  • Runaway Injection Auto-Halt: Identifies when a chaos experiment exceeds its planned concurrency ceiling.
  • Failed Reversion Alarm: Alerts engineers immediately if a target container fails to restore network rules.
  • Agent Unreachability Sentinel: Detects network partitions between the ChaosBlade operator and node agents.

Inputs

Name Type Default Description
chaosblade_metrics_url STRING http://chaosblade-operator.chaosblade.svc.cluster.local:9526 Internal HTTP URL exposing Prometheus metrics for ChaosBlade.
experiment_identifier STRING network-delay-payment-service Identifier of the target ChaosBlade fault injection experiment.
max_execution_errors_threshold INT 1 Maximum allowable experiment execution or rollback errors before alerting.
max_active_injections_threshold INT 5 Maximum allowable concurrent chaos injections across the cluster.
alert_on_unresponsive_probe BOOL true Toggle whether unresponsive probes trigger an immediate incident alert.

Expected outputs

  • {{ outputs.scan_chaosblade_telemetry.vars.active_injections_count }}: Count of active fault injection experiments.
  • {{ outputs.scan_chaosblade_telemetry.vars.execution_errors_total }}: Total count of injection or reversion error events.
  • {{ outputs.scan_chaosblade_telemetry.vars.unresponsive_probes_count }}: Count of node probes failing heartbeat checks.
  • {{ outputs.scan_chaosblade_telemetry.vars.is_alerting }}: Boolean flag indicating if chaos safety bounds are breached.
  • {{ outputs.scan_chaosblade_telemetry.vars.audit_timestamp }}: ISO-8601 UTC timestamp of the ChaosBlade audit run.

Prerequisites

  • ChaosBlade operator deployed on Kubernetes with Prometheus metrics enabled on port 9526.
  • Network connectivity from the Kestra worker to the ChaosBlade operator metrics endpoint.
  • Configured Slack incoming webhook URL with permissions to post in resilience alert channels.

Secrets

  • SLACK_WEBHOOK_URL: Secure webhook URL for routing resilience alerts to the Chaos Engineering Slack channel.

Quick start

  1. Verify that ChaosBlade operator exposes Prometheus metrics on HTTP port 9526.
  2. Add the SLACK_WEBHOOK_URL secret within your Kestra namespace settings.
  3. Specify your experiment identifier in experiment_identifier.
  4. Run a manual flow execution via the Kestra UI to validate metric ingestion.
  5. Enable the periodic_chaosblade_audit schedule trigger to establish automated monitoring.

Common pitfalls and troubleshooting

  • Iptables Cleanup Stalls: Network delay/packet loss injections can leave lingering iptables rules if pod terminates early.
  • DaemonSet HostPID Permissions: Node-level CPU stress experiments require privileged security contexts on daemonset pods.
  • Simultaneous Target Overlap: Never target the same pod with multiple experiments simultaneously; causes kernel lock contention.
  • Operator CRD Reconciliation: Verify the operator has cluster-wide RBAC to inspect and delete chaosexperiments.

How to extend

  • Automated Experiment Abort: Execute a Kestra shell task to delete offending chaosexperiment CRDs if errors spike.
  • PagerDuty Escalation: Escalate to on-call SREs if an experiment fails to revert within 3 minutes of termination.
  • Multi-Experiment Safety Matrix: Expand script parameters to monitor all active chaos experiments across namespaces.

Links

See How

New to Kestra?

Use blueprints to kickstart your first workflows.