agentleFS
dungnotnulldungnotnull/hybrid-harness-chaos-process-prm/skills/s19-application-faults/SKILL.md

chaos-application-faults

Skill19 starsChanged 6 months agoMITView on GitHub

Design and execute application-level chaos experiments targeting pods, containers, network connectivity, DNS, and service dependencies. Use this skill whenever the user says "kill a pod", "test container crash", "inject network latency", "test DNS failure", "simulate service timeout", or needs application-level fault injection manifests for LitmusChaos or Harness Chaos Engineering. Also trigger as part of the chaos experiment design phase (s17 follows s16).

The file

We split this skill into the rules it gives an agent

1 rule. About 0 are common, 1 is distinctive, and 0 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈1

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 0

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Always follow this progression within the application fault phase:

    line 378

≈ “Common” is an estimate: at least 1 in 5 of the 213,897 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Chaos Application Faults (s17)

Purpose

Produce complete, safe, runnable application-level chaos experiments that test service resilience against pod failures, container crashes, network degradation, DNS misconfiguration, and dependency timeouts.


Prerequisites

  • Chaos experiment designs from s14 (Experiment Design)
  • Target application deployed and accessible
  • Steady state defined from s17 (Steady State)
  • Blast radius approved from s16 (Blast Radius Control)
  • Observability active and monitoring application metrics

Input Contract

InputSourceRequired
Experiment design frameworks12 (workflow_context.artifacts)Yes
Service definitions + pod labelss05 outputYes
Blast radius constraintss14 outputYes
Steady state probess15 outputYes
Risk tolerance preferencess02 taste (risk_tolerance)Yes

Output Contract

OutputDestinationFormat
App fault ChaosExperiments.commandcode/artifacts/experiment-app-<fault>.yamlLitmus YAML
App fault ChaosEngines.commandcode/artifacts/engine-app-<fault>.yamlLitmus YAML
Network fault configurations.commandcode/artifacts/experiment-network-<fault>.yamlLitmus YAML
Recovery runbooks18 (game day), s25 (postmortem)Markdown

Application Fault Catalog

FaultLitmusChaos NameRiskScopeProd Safe?
Pod Deletepod-deleteLowNamespacedYes (≤30%)
Pod CPU Hogpod-cpu-hogLowNamespacedYes (≤30%)
Pod Memory Hogpod-memory-hogMediumNamespacedYes (≤30%)
Container Killcontainer-killMediumNamespacedYes (≤30%)
Pod HTTP Latencypod-http-latencyLowNamespacedYes
Pod Network Losspod-network-lossHighNamespacedWith approval
Pod Network Latencypod-network-latencyMediumNamespacedYes
Pod DNS Errorpod-dns-errorMediumNamespacedWith approval
Pod DNS Spoofpod-dns-spoofHighNamespacedNo (staging only)
Pod IO Stresspod-io-stressMediumNamespacedWith approval

Fault 1: Pod Delete (Baseline, Always Run First)

# Generated by: hybrid-harness-chaos-process-prm
apiVersion: litmuschaos.io/v1alpha1
kind: ChaosEngine
metadata:
  name: <SERVICE>-pod-delete-engine
  namespace: <NAMESPACE>
  labels:
    managed-by: hcprm
    fault-category: application
    fault-type: pod-failure
spec:
  appinfo:
    appns: <NAMESPACE>
    applabel: "app=<SERVICE>"
    appkind: deployment
  chaosServiceAccount: litmus-admin
  monitoring: true
  jobCleanUpPolicy: retain
  annotationCheck: "true"    # Only target annotated pods
  engineState: active
  experiments:
    - name: pod-delete
      spec:
        probe:
          - name: application-health-check
            type: httpProbe
            mode: Continuous
            httpProbe/inputs:
              url: "http://<SERVICE>.<NAMESPACE>.svc.cluster.local/health"
              method:
                get:
                  criteria: "=="
                  responseCode: "200"
            runProperties:
              probeTimeout: 5s
              interval: 5s
              retry: 2
              probePollingInterval: 2s
              stopOnFailure: true
          - name: error-rate-check
            type: promProbe
            mode: Edge
            promProbe/inputs:
              endpoint: "http://prometheus.monitoring.svc.cluster.local:9090"
              query: |
                sum(rate(http_requests_total{
                  namespace="<NAMESPACE>",
                  pod=~"<SERVICE>.*",
                  status=~"5.."
                }[2m])) /
                sum(rate(http_requests_total{
                  namespace="<NAMESPACE>",
                  pod=~"<SERVICE>.*"
                }[2m])) * 100
              comparator:
                type: float
                criteria: "<="
                value: "5.0"
            runProperties:
              probeTimeout: 10s
              interval: 30s
              retry: 3
        components:
          env:
            - name: TOTAL_CHAOS_DURATION
              value: "60"
            - name: CHAOS_INTERVAL
              value: "10"
            - name: FORCE
              value: "false"
            - name: PODS_AFFECTED_PERC
              value: "50"
            - name: RAMP_TIME
              value: "10"

Fault 2: Container Kill

apiVersion: litmuschaos.io/v1alpha1
kind: ChaosExperiment
metadata:
  name: container-kill
  namespace: litmus
  labels:
    managed-by: hcprm
    fault-category: application
    fault-type: container-failure
spec:
  definition:
    scope: Namespaced
    env:
      - name: TOTAL_CHAOS_DURATION
        value: "120"
      - name: CHAOS_INTERVAL
        value: "30"             # Kill container every 30s
      - name: TARGET_CONTAINER
        value: "<CONTAINER_NAME>"   # Specific container in pod
      - name: CONTAINER_KILL_SIGNAL
        value: "SIGKILL"        # SIGTERM | SIGKILL
      - name: PODS_AFFECTED_PERC
        value: "50"
      - name: RAMP_TIME
        value: "15"

Fault 3: Pod CPU Hog

apiVersion: litmuschaos.io/v1alpha1
kind: ChaosExperiment
metadata:
  name: pod-cpu-hog
  namespace: litmus
  labels:
    managed-by: hcprm
    fault-category: application
    fault-type: resource-exhaustion
spec:
  definition:
    scope: Namespaced
    env:
      - name: TOTAL_CHAOS_DURATION
        value: "90"
      - name: CPU_CORES
        value: "1"              # Cores to consume
      - name: CPU_LOAD
        value: "80"             # % utilization
      - name: PODS_AFFECTED_PERC
        value: "50"
      - name: CONTAINER_RUNTIME
        value: "containerd"

Fault 4: Pod Memory Hog

apiVersion: litmuschaos.io/v1alpha1
kind: ChaosExperiment
metadata:
  name: pod-memory-hog
  namespace: litmus
  labels:
    managed-by: hcprm
    fault-category: application
    fault-type: resource-exhaustion
spec:
  definition:
    scope: Namespaced
    env:
      - name: TOTAL_CHAOS_DURATION
        value: "90"
      - name: MEMORY_CONSUMPTION_MEGABYTES
        value: "512"            # MB to consume
      - name: MEMORY_PERCENTAGE
        value: "80"             # % of pod memory limit
      - name: PODS_AFFECTED_PERC
        value: "50"
      - name: NUMBER_OF_WORKERS
        value: "4"

Fault 5: Network Latency (Service-to-Service)

apiVersion: litmuschaos.io/v1alpha1
kind: ChaosEngine
metadata:
  name: <SERVICE_A>-to-<SERVICE_B>-latency-engine
  namespace: <NAMESPACE>
  labels:
    managed-by: hcprm
    fault-category: application
    fault-type: network-degradation
spec:
  appinfo:
    appns: <NAMESPACE>
    applabel: "app=<SERVICE_A>"  # Source service pods
    appkind: deployment
  chaosServiceAccount: litmus-admin
  monitoring: true
  engineState: active
  experiments:
    - name: pod-network-latency
      spec:
        probe:
          - name: circuit-breaker-check
            type: promProbe
            mode: Continuous
            promProbe/inputs:
              endpoint: "http://prometheus.monitoring.svc.cluster.local:9090"
              query: |
                circuit_breaker_state{
                  service="<SERVICE_A>",
                  dependency="<SERVICE_B>"
                }
              comparator:
                type: string
                criteria: "=="
                value: "open"       # Expected: circuit breaker triggers
            runProperties:
              probeTimeout: 10s
              interval: 15s
              retry: 3
          - name: user-error-rate
            type: promProbe
            mode: Continuous
            promProbe/inputs:
              endpoint: "http://prometheus.monitoring.svc.cluster.local:9090"
              query: |
                sum(rate(frontend_errors_total[1m])) /
                sum(rate(frontend_requests_total[1m])) * 100
              comparator:
                type: float
                criteria: "<="
                value: "5.0"       # Frontend must serve fallback
            runProperties:
              probeTimeout: 10s
              interval: 15s
              retry: 2
              stopOnFailure: true
        components:
          env:
            - name: TOTAL_CHAOS_DURATION
              value: "120"
            - name: NETWORK_LATENCY
              value: "500"         # 500ms delay
            - name: JITTER
              value: "100"         # ±100ms
            - name: TARGET_PODS
              value: ""            # Affects ALL outbound from source pods
            - name: DESTINATION_IPS
              value: "<SERVICE_B_CLUSTER_IP>"   # Only latency to this service
            - name: NETWORK_INTERFACE
              value: "eth0"

Fault 6: Network Loss (Complete Disconnection)

apiVersion: litmuschaos.io/v1alpha1
kind: ChaosExperiment
metadata:
  name: pod-network-loss
  namespace: litmus
  labels:
    managed-by: hcprm
    fault-category: application
    fault-type: network-partition
spec:
  definition:
    scope: Namespaced
    env:
      - name: TOTAL_CHAOS_DURATION
        value: "60"             # Keep short — total network loss is severe
      - name: NETWORK_PACKET_LOSS_PERCENTAGE
        value: "100"            # Complete loss
      - name: TARGET_PODS
        value: ""
      - name: PODS_AFFECTED_PERC
        value: "100"            # All pods in scope lose network
      - name: DESTINATION_IPS
        value: ""               # Empty = all traffic
      - name: NETWORK_INTERFACE
        value: "eth0"

Fault 7: DNS Error Injection

apiVersion: litmuschaos.io/v1alpha1
kind: ChaosExperiment
metadata:
  name: pod-dns-error
  namespace: litmus
  labels:
    managed-by: hcprm
    fault-category: application
    fault-type: dns-failure
spec:
  definition:
    scope: Namespaced
    env:
      - name: TOTAL_CHAOS_DURATION
        value: "120"
      - name: TARGET_SERVICE_NAME
        value: "<DEPENDENCY_SERVICE>"     # Service whose DNS is poisoned
      - name: MATCH_SCHEME
        value: "exact"            # exact | prefix | suffix | regex
      - name: ERROR_TYPE
        value: "error"            # error | random
      - name: PODS_AFFECTED_PERC
        value: "100"

Fault Escalation Ladder

Always follow this progression within the application fault phase:

1. Pod Delete (50%) → validate self-healing
    ↓ PASS
2. Container Kill → validate container restart
    ↓ PASS
3. Pod CPU Hog → validate resource throttling
    ↓ PASS
4. Pod Memory Hog → validate OOM handling
    ↓ PASS
5. Network Latency (100ms → 250ms → 500ms) → validate timeouts/circuit breakers
    ↓ PASS
6. Network Loss (scoped to single service) → validate graceful degradation
    ↓ PASS
7. DNS Error (scoped to non-critical dependency) → validate fallback

Circuit Breaker Verification

During network chaos, validate circuit breaker behavior:

// circuit-breaker-monitor.ts — Runs alongside chaos experiment
import { register, collectDefaultMetrics, Gauge } from 'prom-client';

const circuitBreakerState = new Gauge({
  name: 'circuit_breaker_state',
  help: '0=closed, 1=open, 2=half_open',
  labelNames: ['service', 'dependency'],
});

async function monitorCircuitBreaker(service: string, dependency: string) {
  const state = await fetchCircuitBreakerMetrics(service, dependency);

  // Expected state transitions during latency injection:
  // T0:     CLOSED (normal)
  // T0+15s: CLOSED (latency building up)
  // T0+25s: OPEN (threshold exceeded — circuit breaker trips)
  // T0+90s: HALF_OPEN (probe requests sent after cooldown)
  // T0+120s: CLOSED (fault removed, circuit recovers)

  if (state === 'open') {
    console.log('✅ Circuit breaker opened as expected — service is protected');
  } else {
    console.warn(`⚠️ Circuit breaker state: ${state} — expected "open"`);
  }
}

Recovery Runbook

Pod Delete

# Self-healing — Kubernetes restarts pods automatically
# Verify: kubectl get pods -n <NAMESPACE> -l app=<SERVICE> -w
# Expected recovery: < 30s

Network Latency

# Chaos duration expires → latency removed automatically
# Verify: curl -w "\nTotal time: %{time_total}s\n" http://<SERVICE_A>/health
# Expected: latency returns to < 50ms

DNS Error

# Chaos duration expires → DNS restored automatically
# Verify: kubectl exec -it <POD> -n <NAMESPACE> -- nslookup <DEPENDENCY>
# If persistent: kubectl rollout restart deployment/coredns -n kube-system

AI Agent Integration

Autonomy Level

AspectLevelDescription
CurrentL1AI generates application fault manifests
TargetL2AI generates pod/container/network/DNS fault YAML

Harness AI Agent

Agent: Harness AI Reliability Agent Capabilities:

  • Application fault manifest generation (pod-delete, container-kill, network, DNS)
  • Fault Flags for application-level chaos
  • Target selection based on service topology

Human Gates

  • Production application fault approval
  • Fault Flag activation

MCP

  • LitmusChaos MCP
  • Harness Fault Flags

Industry Context

Application-level chaos is critically underrepresented in practice (3.0% of experiments per GitHub study of 971 repos) -- this skill addresses a documented industry gap.


Success Criteria

  • All 7 fault types designed and validated in dev
  • Pod Delete passes with 100% health probe success
  • Circuit breakers verified for network faults
  • OOM handling triggers graceful shutdown (not crash loop)
  • Fault escalation ladder followed (never skip to network loss)
  • Recovery runbooks tested for each fault type
  • All experiments have stopOnFailure: true on at least one probe
  • Staging results documented before considering production

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.