Chaos Engineering

Automated fault injection and resilience testing.

j4flmao Updated

File contents

Chaos Engineering

Automated fault injection and resilience testing to ensure system reliability.

Fault Injection Snippet (YAML)

apiVersion: chaos-mesh.org/v1alpha1
kind: NetworkChaos
metadata:
  name: network-delay
  namespace: default
spec:
  action: delay
  mode: one
  selector:
    labelSelectors:
      app: my-app
  delay:
    latency: "500ms"
    correlation: "100"
    jitter: "0ms"
  duration: "30s"

Resilience Test Pipeline (Bash)

#!/bin/bash
echo "Applying NetworkChaos..."
kubectl apply -f network-delay.yaml

echo "Running health checks..."
for i in {1..5}; do
    curl -s --max-time 1 http://my-app.default.svc.cluster.local/health || echo "Health check failed"
    sleep 5
done

echo "Cleaning up..."
kubectl delete -f network-delay.yaml

Chaos Workflow

%%{init: {"theme": "default", "flowchart": {"useMaxWidth": true}}}%%
flowchart TD
    A["Define Steady State"] --> B["Hypothesize Fault Impact"]
    B --> C["Inject Fault"]
    C --> D{"Observe System"}
    D -->|"Recovers"| E["Resilient System"]
    D -->|"Fails"| F["Identify Weakness"]
    F --> G["Improve System"]
    G --> A

j4flmao/agent-skills/tree/main/skills/devops/chaos-engineering commit 23c3ea8774

Frequently asked questions

npx skillmds@latest add j4flmao/chaos-engineering