litmus
Litmus helps SREs and developers practice chaos engineering in a Cloud-native way. Chaos experiments are published at the ChaosHub (https://hub.litmuschaos.io). Community notes is at https://hackmd.io/a4Zu_sH4TZGeih-xCimi3Q
Top Related Projects
Chaos Engineering Toolkit & Orchestration for Developers
A Chaos Engineering Platform for Kubernetes.
An easy to use and powerful chaos engineering experiment toolkit.(阿里巴巴开源的一款简单易用、功能强大的混沌实验注入工具)
Chaos testing, network emulation, and stress testing tool for containers
A powerful testing tool for Kubernetes clusters.
Quick Overview
Litmus is an open-source Chaos Engineering platform for Kubernetes environments. It provides a comprehensive set of tools and frameworks to design, execute, and observe chaos experiments, helping teams improve the resilience and reliability of their cloud-native applications.
Pros
- Extensive library of pre-defined chaos experiments for various Kubernetes resources
- Integrates well with CI/CD pipelines for automated chaos testing
- Provides a user-friendly web interface (ChaosCenter) for experiment management
- Supports custom experiment creation and workflow automation
Cons
- Steep learning curve for users new to Chaos Engineering concepts
- Limited support for non-Kubernetes environments
- Some advanced features may require additional setup and configuration
- Documentation can be overwhelming for beginners
Code Examples
- Installing Litmus using Helm:
helm repo add litmuschaos https://litmuschaos.github.io/litmus-helm/
helm install chaos litmuschaos/litmus --namespace=litmus --create-namespace
- Applying a pod-delete chaos experiment:
apiVersion: litmuschaos.io/v1alpha1
kind: ChaosEngine
metadata:
name: nginx-chaos
namespace: default
spec:
appinfo:
appns: 'default'
applabel: 'app=nginx'
appkind: 'deployment'
chaosServiceAccount: pod-delete-sa
experiments:
- name: pod-delete
spec:
components:
env:
- name: TOTAL_CHAOS_DURATION
value: '30'
- name: CHAOS_INTERVAL
value: '10'
- name: FORCE
value: 'false'
- Running a chaos experiment using the Litmus CLI:
litmus run chaos --name nginx-chaos
Getting Started
To get started with Litmus:
-
Install Litmus on your Kubernetes cluster:
kubectl apply -f https://litmuschaos.github.io/litmus/2.9.0/litmus-2.9.0.yaml
-
Access the ChaosCenter UI:
kubectl port-forward svc/chaos-litmus-frontend-service 9091:9091 -n litmus
Open http://localhost:9091 in your browser.
-
Create a ChaosExperiment and ChaosEngine as shown in the code examples above.
-
Run the experiment using the ChaosCenter UI or Litmus CLI.
-
Observe the results and analyze the impact on your application.
Competitor Comparisons
Chaos Engineering Toolkit & Orchestration for Developers
Pros of Chaostoolkit
- Language-agnostic with support for multiple programming languages
- Extensible architecture allowing custom extensions and integrations
- Comprehensive documentation and active community support
Cons of Chaostoolkit
- Steeper learning curve for beginners
- Less focus on Kubernetes-specific chaos experiments
- Smaller ecosystem of pre-built experiments compared to Litmus
Code Comparison
Litmus experiment definition:
apiVersion: litmuschaos.io/v1alpha1
kind: ChaosEngine
metadata:
name: nginx-chaos
spec:
appinfo:
appns: 'default'
applabel: 'app=nginx'
chaosServiceAccount: pod-delete-sa
experiments:
- name: pod-delete
Chaostoolkit experiment definition:
{
"version": "1.0.0",
"title": "What happens when we kill a microservice?",
"description": "N/A",
"steady-state-hypothesis": {
"title": "Services are all available and healthy",
"probes": [
{
"type": "probe",
"name": "all-services-are-healthy",
"tolerance": true,
"provider": {
"type": "python",
"module": "chaosk8s.probes",
"func": "all_microservices_healthy"
}
}
]
},
"method": [
{
"type": "action",
"name": "kill-microservice",
"provider": {
"type": "python",
"module": "chaosk8s.pod.actions",
"func": "terminate_pods",
"arguments": {
"label_selector": "app=my-app",
"name_pattern": "my-app-*",
"rand": true
}
},
"pauses": {
"after": 10
}
}
]
}
A Chaos Engineering Platform for Kubernetes.
Pros of Chaos Mesh
- More extensive fault injection types, including network, I/O, and kernel faults
- Better support for multi-cluster scenarios and cloud-native environments
- User-friendly web UI for experiment management and visualization
Cons of Chaos Mesh
- Steeper learning curve due to more complex architecture
- Less extensive documentation compared to Litmus
- Fewer pre-built chaos experiments available out-of-the-box
Code Comparison
Litmus experiment definition:
apiVersion: litmuschaos.io/v1alpha1
kind: ChaosEngine
metadata:
name: nginx-chaos
spec:
appinfo:
appns: 'default'
applabel: 'app=nginx'
chaosServiceAccount: pod-delete-sa
experiments:
- name: pod-delete
Chaos Mesh experiment definition:
apiVersion: chaos-mesh.org/v1alpha1
kind: PodChaos
metadata:
name: pod-failure
spec:
action: pod-failure
mode: one
selector:
labelSelectors:
'app': 'nginx'
Both Litmus and Chaos Mesh are powerful chaos engineering tools for Kubernetes environments. Litmus offers a more straightforward approach with extensive documentation and pre-built experiments, making it easier for beginners. Chaos Mesh provides more advanced features and fault injection types, catering to complex scenarios and cloud-native environments. The choice between the two depends on the specific requirements and complexity of the target infrastructure.
An easy to use and powerful chaos engineering experiment toolkit.(阿里巴巴开源的一款简单易用、功能强大的混沌实验注入工具)
Pros of ChaosBlade
- Supports a wider range of platforms, including Linux, Windows, and Kubernetes
- Offers a more extensive set of chaos experiments, including network, disk, and process-level faults
- Provides a CLI tool for easier experiment execution and management
Cons of ChaosBlade
- Less focus on cloud-native environments compared to Litmus
- Smaller community and fewer integrations with other tools
- Documentation is not as comprehensive as Litmus
Code Comparison
ChaosBlade experiment definition:
apiVersion: chaosblade.io/v1alpha1
kind: ChaosBlade
metadata:
name: cpu-load
spec:
experiments:
- scope: node
target: cpu
action: fullload
Litmus experiment definition:
apiVersion: litmuschaos.io/v1alpha1
kind: ChaosEngine
metadata:
name: cpu-stress
spec:
appinfo:
appns: default
applabel: 'app=nginx'
chaosServiceAccount: litmus-admin
experiments:
- name: cpu-stress
Both ChaosBlade and Litmus are powerful chaos engineering tools, but they cater to slightly different use cases. ChaosBlade offers a broader range of experiments across various platforms, while Litmus is more focused on cloud-native and Kubernetes environments. The choice between the two depends on the specific requirements of your infrastructure and the types of chaos experiments you need to perform.
Chaos testing, network emulation, and stress testing tool for containers
Pros of Pumba
- Simpler setup and usage, focused specifically on Docker container chaos testing
- Lightweight and easy to integrate into existing Docker environments
- Supports network emulation for simulating various network conditions
Cons of Pumba
- Limited scope compared to Litmus, focusing primarily on Docker containers
- Fewer built-in experiments and scenarios compared to Litmus' extensive catalog
- Less active community and development compared to Litmus
Code Comparison
Pumba command example:
pumba netem --duration 2m delay --time 3000 re2:^redis
Litmus experiment example:
apiVersion: litmuschaos.io/v1alpha1
kind: ChaosEngine
metadata:
name: nginx-chaos
spec:
appinfo:
appns: 'default'
applabel: 'app=nginx'
appkind: 'deployment'
chaosServiceAccount: pod-delete-sa
experiments:
- name: pod-delete
spec:
components:
env:
- name: TOTAL_CHAOS_DURATION
value: '30'
While Pumba focuses on Docker-specific chaos engineering with simple command-line usage, Litmus offers a more comprehensive Kubernetes-native chaos engineering platform with a wider range of experiments and scenarios.
A powerful testing tool for Kubernetes clusters.
Pros of PowerfulSeal
- Focused on Kubernetes-specific chaos testing, providing deeper integration with K8s components
- Offers a powerful CLI interface for quick and easy chaos experiments
- Includes a web UI for visualizing and managing chaos scenarios
Cons of PowerfulSeal
- Less extensive ecosystem and community support compared to Litmus
- More limited in terms of supported platforms and integrations
- Fewer pre-defined chaos experiments and scenarios available out-of-the-box
Code Comparison
PowerfulSeal example:
from powerfulseal.policy import PolicyRunner
from powerfulseal.k8s import K8sClient
k8s_client = K8sClient()
runner = PolicyRunner(k8s_client)
runner.run(policy_file="chaos_policy.yml")
Litmus example:
apiVersion: litmuschaos.io/v1alpha1
kind: ChaosEngine
metadata:
name: nginx-chaos
spec:
appinfo:
appns: 'default'
applabel: 'app=nginx'
chaosServiceAccount: pod-delete-sa
experiments:
- name: pod-delete
Both projects aim to introduce chaos into Kubernetes clusters, but they differ in their approach and implementation. PowerfulSeal offers a more programmatic and Kubernetes-focused solution, while Litmus provides a broader range of chaos experiments and a more extensive ecosystem.
Convert designs to code with AI
Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.
Try Visual CopilotREADME
LitmusChaos
Open Source Chaos Engineering Platform
Read this in other languages.
ð°ð· ð¨ð³ ð§ð· ð®ð³
Overview
LitmusChaos is an open source Chaos Engineering platform that enables teams to identify weaknesses & potential outages in infrastructures by inducing chaos tests in a controlled way. Developers & SREs can practice Chaos Engineering with LitmusChaos as it is easy to use, based on modern Chaos Engineering principles & community collaborated. It is 100% open source & a CNCF project.
LitmusChaos takes a cloud-native approach to create, manage and monitor chaos. The platform itself runs as a set of microservices and uses Kubernetes custom resources (CRs) to define the chaos intent, as well as the steady state hypothesis.
At a high-level, Litmus comprises of:
- Chaos Control Plane: A centralized chaos management tool called chaos-center, which helps construct, schedule and visualize Litmus chaos workflows
- Chaos Execution Plane Services: Made up of a chaos agent and multiple operators that execute & monitor the experiment within a defined target Kubernetes environment.
At the heart of the platform are the following chaos custom resources:
-
ChaosExperiment: A resource to group the configuration parameters of a particular fault. ChaosExperiment CRs are essentially installable templates that describe the library carrying out the fault, indicate permissions needed to run it & the defaults it will operate with. Through the ChaosExperiment, Litmus supports BYOC (bring-your-own-chaos) that helps integrate (optional) any third-party tooling to perform the fault injection.
-
ChaosEngine: A resource to link a Kubernetes application workload/service, node or an infra component to a fault described by the ChaosExperiment. It also provides options to tune the run properties and specify the steady state validation constraints using 'probes'. ChaosEngine is watched by the Chaos-Operator, which reconciles it (triggers experiment execution) via runners.
The ChaosExperiment & ChaosEngine CRs are embedded within a Workflow object that can string together one or more experiments in a desired order.
- ChaosResult: A resource to hold the results of the experiment run. It provides details of the success of each validation constraint, the revert/rollback status of the fault as well as a verdict. The Chaos-exporter reads the results and exposes information as prometheus metrics. ChaosResults are especially useful during automated runs.
ChaosExperiment CRs are hosted on hub.litmuschaos.io. It is a central hub where the application developers or vendors share their chaos experiments so that their users can use them to increase the resilience of the applications in production.
Use cases
- For Developers: To run chaos experiments during application development as an extension of unit testing or integration testing.
- For CI/CD pipeline builders: To run chaos as a pipeline stage to find bugs when the application is subjected to fail paths in a pipeline.
- For SREs: To plan and schedule chaos experiments into the application and/or surrounding infrastructure. This practice identifies the weaknesses in the deployment system and increases resilience.
Getting Started with Litmus
To get started, check out the Litmus Docs and specifically the Installation section of the Getting Started with Litmus page.
Contributing to Chaos Hub
Check out the Contributing Guidelines for the Chaos Hub
Community
Community Resources:
Feel free to reach out if you have any queries,concerns, or feature requests
-
Give us a star âï¸ - If you are using LitmusChaos or think it is an interesting project, we would love a star â¤ï¸
-
Follow LitmusChaos on Twitter @LitmusChaos.
-
Subscribe to the LitmusChaos YouTube channel for regular updates & meeting recordings.
-
To join our Slack Community and meet our community members, put forward your questions & opinions, join the #litmus channel on the Kubernetes Slack.
Community Meetings
-
Community Meetings These will be hosted every 3rd Wednesday of every month at 5:30 PM GMT /6:30 PM CEST /10 PM IST The community meetings will involve discussing community updates, sharing updates on new features/releases and discussing user/adopter stories. Everyone in the community is invited for the same to participate in the LitmusChaos community meetings.
-
Contributor Meetings These will be hosted every second & last Thursday of every month at 2:30 PM GMT /3:30 PM CEST /7 PM IST The contributor meetings are only meant to discuss technical and non-technical contributions to LitmusChaos. Maintainers, present Contributors and aspiring contributors are invited to participate in the LitmusChaos contributor meetings to discuss issues, fixes, enhancements and future contributions
Fill out the LitmusChaos Meetings invite form to get your Calendar invite!
Videos
- What if Your System Experiences an Outage? Let's Build a Resilient Systems with Chaos Engineering @ CNCF
- Enhancing Cyber Resilience Through Zero Trust Chaos Experiments in Cloud Native Environments @ CNCF
- LitmusChaos, with Karthik Satchitanand @ The Kubernetes Podcast from Google
- Cultural Shifts: Fostering a Chaos First Mindset in Platform Engineering @ CNCF
- Fire in the Cloud: Bringing Managed Services Under the Ambit of Cloud-Native Chaos Engineering @ CNCF
- Security Controls for Safe Chaos Experimentation @ CNCF
- Chaos Engineering For Hybrid Targets With LitmusChaos @ CNCF
- Cloud Native Live: Litmus Chaos Engine and a microservices demo app
- Chaos Engineering hands-on - An SRE ideating Chaos Experiments and using LitmusChaos | July 2022
- Achieve Digital Product Resiliency with Chaos Engineering
- Case Study: Bringing Chaos Engineering to the Cloud Native Developers @ CNCF
- Cloud Native Chaos Engineering with LitmusChaos @ CNCF
- How to create Chaos Experiments with Litmus | Litmus Chaos tutorial @ Is it Observable
- Cloud Native Chaos Engineering Preview With LitmusChaos
- Get started with Chaos Engineering with Litmus @ Containers from the Couch
- Litmus 2 - Chaos Engineering Meets Argo Workflows @ DevOps Toolkit
- Hands-on with Litmus 2.0 | Rawkode Live @ Rawkode Academy
- Introducing LitmusChaos 2.0 / Dok Talks #74 @ DoK.community
- Introduction to Cloud Native Chaos Engineering @ Kunal Kushwaha
- #EveryoneCanContribute cafe: Litmus - Chaos Engineering for your Kubernetes @ GitLab Unfiltered
- Litmus - Chaos Engineering for Kubernetes (CNCFMinutes 9) @ Saiyam Pathak
- Chaos Engineering with Litmus Chaos by Prithvi Raj || HACKODISHA Workshop @ Webwiz
Blogs
- CNCF: Introduction to LitmusChaos
- Hackernoon: Manage and Monitor Chaos via Litmus Custom Resources
- Observability Considerations in Chaos: The Metrics Story
Community Blogs:
- LiveWyer: LitmusChaos Showcase: Chaos Experiments in a Helm Chart Test Suite
- Jessica Cherry: Test Kubernetes cluster failures and experiments in your terminal
- Yang Chuansheng(KubeSphere): KubeSphere é¨ç½² Litmus è³ Kubernetes å¼å¯æ··æ²å®éª
- Saiyam Pathak(Civo): Chaos Experiments on Kubernetes using Litmus to ensure your cluster is production ready
- Andreas Krivas(Container Solutions):Comparing Chaos Engineering Tools for Kubernetes Workloads
- Akram Riahi(WeScale):Chaos Engineering : Litmus sous tous les angles
- Prashanto Priyanshu(LensKart):Lenskartâs approach to Chaos Engineering-Part 2
- DevsDay.ru(Russian):LitmusChaos at Kubecon EU '21
Adopters
Check out the Adopters of LitmusChaos
(Send a PR to the above page if you are using Litmus in your chaos engineering practice)
License
Litmus is licensed under the Apache License, Version 2.0. See LICENSE for the full license text. Some of the projects used by the Litmus project may be governed by a different license, please refer to its specific license.
Litmus Chaos is part of the CNCF Projects.
Important Links
Litmus DocsCNCF Landscape
Top Related Projects
Chaos Engineering Toolkit & Orchestration for Developers
A Chaos Engineering Platform for Kubernetes.
An easy to use and powerful chaos engineering experiment toolkit.(阿里巴巴开源的一款简单易用、功能强大的混沌实验注入工具)
Chaos testing, network emulation, and stress testing tool for containers
A powerful testing tool for Kubernetes clusters.
Convert designs to code with AI
Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.
Try Visual Copilot