# Chaos Engineering

> Fault injection mechanics at network/kernel layer and blast radius containment.

- Skill: `j4flmao/chaos-engineering-2` (Agent Skill)
- Install (CLI): `npx skillmds@latest add j4flmao/chaos-engineering-2`
- Raw SKILL.md: https://api.skillmd.com/api/skills/j4flmao/chaos-engineering-2/raw
- Safety review: pending
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: Coding & Dev Tools
- Author: j4flmao (https://skillmd.com/u/j4flmao)
- Updated: 2026-09-21
- Page: https://skillmd.com/skills/j4flmao/chaos-engineering-2

---

# Chaos Engineering: Under the Hood

Chaos engineering involves deliberate fault injection to validate system resilience.

## Kernel-Layer Fault Injection
Tools like eBPF (Extended Berkeley Packet Filter) and Linux `tc` (Traffic Control) allow precise, low-overhead fault injection directly into the kernel network stack.
- **eBPF System Call Hooking**: Overriding `connect()`, `read()`, or `write()` syscalls to return synthetic `EAGAIN` or `ETIMEDOUT` errors.
- **Traffic Shaping**: Using `tc-netem` (Network Emulator) for packet corruption, delay, or dropping.

```mermaid
flowchart TD
%%{init: {"theme": "default", "flowchart": {"useMaxWidth": true}}}%%
    subgraph InjectionLayerKernelLayerInjection ["Kernel Layer Injection<br><br><br>"]
        App[Application] -->|"syscall()"| Kernel[Linux Kernel]
        Kernel -->|"eBPF_Hook(Syscall)"| ErrorGen[Synthetic Error]
        Kernel -->|"tc_qdisc(eth0)"| NetDelay[Packet Delay]
    end
    subgraph SafetyBlastRadiusContainment ["Blast Radius Containment<br><br><br>"]
        Target[Target Selection] --> Namespace[Network Namespaces]
        Namespace --> CGroups[Control Groups]
    end
```

## Blast Radius Containment
- **cgroups and Namespaces**: Restricting chaos agents to specific container namespaces ensures isolation.
- **Abort Conditions**: Real-time evaluation of Golden Signals (Latency, Traffic, Errors, Saturation). If SLIs breach the containment threshold, all eBPF hooks and `tc` rules are instantly flushed.

