Overview
LitmusChaos is designed specifically for Kubernetes. It uses Kubernetes Custom Resources (CRDs) to define and execute chaos experiments, making it declarative and GitOps-friendly.
Key Concepts
- Experiment: A single chaos scenario (e.g., pod-delete, node-cpu-hog).
- ChaosEngine: The resource that links an experiment to an application.
- ChaosResult: The output resource that contains the verdict of the experiment.
Example: Running a Litmus Experiment
Apply a ChaosEngine that targets an application deployment.
apiVersion: litmuschaos.io/v1alpha1
kind: ChaosEngine
metadata:
name: engine-nginx
spec:
appinfo:
appns: default
applabel: 'app=nginx'
appkind: deployment
experiments:
- name: pod-deleteExpected Result: Litmus will inject chaos, and you can check the result status:
kubectl get chaosresult engine-nginx-pod-delete -o yamlOutput:
status:
experimentstatus:
verdict: "Pass" # Result: Experiment verified successfully.