{"id":42827,"date":"2024-01-27T07:35:11","date_gmt":"2024-01-27T07:35:11","guid":{"rendered":"https:\/\/www.devopsschool.com\/blog\/?p=42827"},"modified":"2024-01-27T07:35:13","modified_gmt":"2024-01-27T07:35:13","slug":"what-is-litmus-chaos-and-use-cases-of-litmus-chaos","status":"publish","type":"post","link":"https:\/\/www.devopsschool.com\/blog\/what-is-litmus-chaos-and-use-cases-of-litmus-chaos\/","title":{"rendered":"What is Litmus Chaos and use cases of Litmus Chaos?"},"content":{"rendered":"\n<h2 class=\"wp-block-heading\">What is Litmus Chaos?<\/h2>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full is-resized\"><img loading=\"lazy\" decoding=\"async\" width=\"834\" height=\"418\" src=\"https:\/\/www.devopsschool.com\/blog\/wp-content\/uploads\/2024\/01\/image-404.png\" alt=\"\" class=\"wp-image-42837\" style=\"width:650px;height:auto\" srcset=\"https:\/\/www.devopsschool.com\/blog\/wp-content\/uploads\/2024\/01\/image-404.png 834w, https:\/\/www.devopsschool.com\/blog\/wp-content\/uploads\/2024\/01\/image-404-300x150.png 300w, https:\/\/www.devopsschool.com\/blog\/wp-content\/uploads\/2024\/01\/image-404-768x385.png 768w\" sizes=\"auto, (max-width: 834px) 100vw, 834px\" \/><figcaption class=\"wp-element-caption\"><strong><em>What is Litmus Chaos<\/em><\/strong><\/figcaption><\/figure>\n<\/div>\n\n\n<p>Litmus Chaos is an end-to-end <strong>Chaos Engineering platform<\/strong> specifically designed for cloud-native environments. It empowers you to <strong>inject controlled chaos<\/strong> into your applications and infrastructure, uncovering weaknesses and building <strong>resilience<\/strong> against real-world disruptions.<\/p>\n\n\n\n<p>Think of it as a stress test on steroids, simulating various failure scenarios like:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Pod crashes:<\/strong> Simulate unexpected terminations of your application containers.<\/li>\n\n\n\n<li><strong>Network disruptions:<\/strong> Introduce packet loss, latency, or even complete network partitions.<\/li>\n\n\n\n<li><strong>Resource limitations:<\/strong> Deplete CPU, memory, or storage resources to test resource handling.<\/li>\n\n\n\n<li><strong>Chaos at platform level:<\/strong> Inject chaos into services like Kubernetes nodes, disks, and network resources.<\/li>\n\n\n\n<li><strong>Application-specific faults:<\/strong> Trigger specific errors or exceptions within your application code.<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">Top 10 use cases of Litmus Chaos?<\/h2>\n\n\n\n<p>Top 10 Use Cases of Litmus Chaos:<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li><strong>Identify Single Points of Failure:<\/strong> Pinpoint critical components that cause cascading failures when disrupted.<\/li>\n\n\n\n<li><strong>Validate Disaster Recovery Plans:<\/strong> Test your recovery procedures and identify areas for improvement.<\/li>\n\n\n\n<li><strong>Strengthen System Scalability:<\/strong> Uncover bottlenecks and ensure your system can handle increased load.<\/li>\n\n\n\n<li><strong>Enhance Security Posture:<\/strong> Simulate cyberattacks and assess your system&#8217;s vulnerability.<\/li>\n\n\n\n<li><strong>Boost Team Collaboration:<\/strong> Foster communication and understanding of system behavior under stress across teams.<\/li>\n\n\n\n<li><strong>Continuous Improvement:<\/strong> Regularly inject chaos to proactively identify and mitigate potential issues.<\/li>\n\n\n\n<li><strong>Develop Fault-Tolerant Systems:<\/strong> Design systems that can gracefully handle failures and maintain service.<\/li>\n\n\n\n<li><strong>Practice Incident Response:<\/strong> Train your team on handling real-world disruptions through simulated scenarios.<\/li>\n\n\n\n<li><strong>Validate Infrastructure Stability:<\/strong> Test the resilience of your underlying cloud infrastructure.<\/li>\n\n\n\n<li><strong>Measure System Resilience:<\/strong> Quantify the impact of failures and track improvements over time.<\/li>\n<\/ol>\n\n\n\n<p><strong>Litmus Chaos offers several advantages:<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Cloud-Native Focus:<\/strong> Specifically designed for Kubernetes and cloud-native applications, integrating seamlessly with existing architectures.<\/li>\n\n\n\n<li><strong>Diverse Fault Injection:<\/strong> Supports various fault types at both application and platform levels for comprehensive testing.<\/li>\n\n\n\n<li><strong>Easy to Use:<\/strong> Provides a user-friendly web interface and CLI for experiment design and execution.<\/li>\n\n\n\n<li><strong>Open-source and Community-driven:<\/strong> Continuously evolving with active community contributions and readily available resources.<\/li>\n<\/ul>\n\n\n\n<p><strong>Note:<\/strong> Chaos Engineering is a powerful tool, but it&#8217;s crucial to use it responsibly and start with small, controlled experiments. By embracing controlled chaos, you can proactively build stronger, more resilient cloud-native systems that can withstand unexpected challenges.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">What are the feature of Litmus Chaos?<\/h2>\n\n\n\n<p>Litmus Chaos, a popular open-source Chaos Engineering platform, boasts a diverse set of features designed to help you test and strengthen your systems:<\/p>\n\n\n\n<p><strong>Chaos Experimentation:<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Declarative Chaos Experiments:<\/strong> Define chaos scenarios using Kubernetes custom resources (CRs) for easy configuration and management.<\/li>\n\n\n\n<li><strong>Chaostypes and Fault Injection:<\/strong> Choose from various chaos types like network chaos, pod chaos, resource chaos, and inject faults to simulate real-world failures.<\/li>\n\n\n\n<li><strong>Chaos Schedules and Automation:<\/strong> Schedule chaos experiments to run periodically or integrate them into CI\/CD pipelines for continuous testing.<\/li>\n\n\n\n<li><strong>Chaos Scenarios and Templates:<\/strong> Build complex chaos scenarios by chaining multiple Chaostypes or utilize pre-built templates for common testing needs.<\/li>\n<\/ul>\n\n\n\n<p><strong>Observability and Analytics:<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Resilience Probes:<\/strong> Define custom probes to monitor system behavior during chaos experiments and measure their impact.<\/li>\n\n\n\n<li><strong>Chaos Reports and Analytics:<\/strong> Generate detailed reports summarizing experiment results, including visualizations and analysis of system behavior.<\/li>\n\n\n\n<li><strong>Integration with Prometheus and Grafana:<\/strong> Export metrics and dashboards for deeper analysis and integration with existing monitoring tools.<\/li>\n\n\n\n<li><strong>Experiment History and Comparison:<\/strong> Track past experiments, compare results, and identify patterns for effective testing strategies.<\/li>\n<\/ul>\n\n\n\n<p><strong>Collaboration and Ease of Use:<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>GitOps Support:<\/strong> Manage chaos experiments using Git for version control and collaboration.<\/li>\n\n\n\n<li><strong>Role-Based Access Control:<\/strong> Define user roles and permissions for secure access and management of experiments.<\/li>\n\n\n\n<li><strong>Intuitive UI and CLI:<\/strong> Leverage a user-friendly web interface and command-line interface for convenient experiment configuration and execution.<\/li>\n\n\n\n<li><strong>Community and Support:<\/strong> Access a vibrant community of users and developers for support, collaboration, and sharing best practices.<\/li>\n<\/ul>\n\n\n\n<p><strong>Additional Features:<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Chaos Hub:<\/strong> Discover and share pre-built chaos experiments for various platforms and applications.<\/li>\n\n\n\n<li><strong>Chaos Engine API:<\/strong> Integrate Litmus Chaos with other tools and platforms through a robust API.<\/li>\n\n\n\n<li><strong>Custom Scripting:<\/strong> Extend functionality by writing custom scripts for specific chaos scenarios.<\/li>\n\n\n\n<li><strong>Platform Agnostic:<\/strong> Run chaos experiments on Kubernetes, bare-metal environments, and other platforms.<\/li>\n<\/ul>\n\n\n\n<p>These are just highlights, and Litmus Chaos offers a comprehensive set of features and functionalities.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">How Litmus Chaos works and Architecture?<\/h2>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full is-resized\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"584\" src=\"https:\/\/www.devopsschool.com\/blog\/wp-content\/uploads\/2024\/01\/image-406.png\" alt=\"\" class=\"wp-image-42839\" style=\"width:644px;height:auto\" srcset=\"https:\/\/www.devopsschool.com\/blog\/wp-content\/uploads\/2024\/01\/image-406.png 1024w, https:\/\/www.devopsschool.com\/blog\/wp-content\/uploads\/2024\/01\/image-406-300x171.png 300w, https:\/\/www.devopsschool.com\/blog\/wp-content\/uploads\/2024\/01\/image-406-768x438.png 768w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><figcaption class=\"wp-element-caption\"><strong><em>Litmus Chaos works and Architecture<\/em><\/strong><\/figcaption><\/figure>\n<\/div>\n\n\n<p>Litmus Chaos works through a well-defined architecture that orchestrates chaos injection and analyzes its impact on your system. Here&#8217;s a breakdown:<\/p>\n\n\n\n<p><strong>Components:<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Control Plane:<\/strong>\n<ul class=\"wp-block-list\">\n<li><strong>ChaosCenter:<\/strong> Web interface for creating, scheduling, and monitoring chaos experiments.<\/li>\n\n\n\n<li><strong>API Server:<\/strong> Handles API requests from the ChaosCenter and other components.<\/li>\n\n\n\n<li><strong>Experiment Runner:<\/strong> Responsible for interpreting chaos experiment definitions and scheduling their execution.<\/li>\n<\/ul>\n<\/li>\n\n\n\n<li><strong>Execution Plane:<\/strong>\n<ul class=\"wp-block-list\">\n<li><strong>Chaos Runner:<\/strong> Runs on target resources and injects faults based on the experiment definition.<\/li>\n\n\n\n<li><strong>Chaos Probes:<\/strong> Monitor system behavior during the experiment and collect data.<\/li>\n\n\n\n<li><strong>Report Generator:<\/strong> Analyzes collected data and generates reports on experiment results.<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n\n\n\n<p><strong>Workflow:<\/strong><\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li><strong>Define Chaos Experiment:<\/strong> You configure the desired chaos scenario using Kubernetes custom resources (CRs) through the ChaosCenter.<\/li>\n\n\n\n<li><strong>Experiment Scheduling:<\/strong> You schedule the experiment to run at a specific time or integrate it into CI\/CD pipelines.<\/li>\n\n\n\n<li><strong>Chaos Injection:<\/strong> The Experiment Runner interprets the CR and instructs the Chaos Runner on the target resources to inject faults according to the specified ChaosTypes (e.g., network disruptions, pod terminations).<\/li>\n\n\n\n<li><strong>Monitoring and Data Collection:<\/strong> Chaos Probes monitor system behavior during the experiment, gathering metrics and logs.<\/li>\n\n\n\n<li><strong>Analysis and Reporting:<\/strong> The Report Generator analyzes the collected data and generates detailed reports summarizing the experiment results and system behavior.<\/li>\n\n\n\n<li><strong>User Insights:<\/strong> You can access the reports and visualizations through the ChaosCenter to gain insights into your system&#8217;s resilience and identify potential weaknesses.<\/li>\n<\/ol>\n\n\n\n<p><strong>Key Architectural Aspects:<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Declarative Chaos Experiments:<\/strong> CRs provide a standardized and readable way to define chaos scenarios.<\/li>\n\n\n\n<li><strong>Kubernetes-native:<\/strong> Tightly integrates with Kubernetes for seamless deployment and management.<\/li>\n\n\n\n<li><strong>Scalable and Distributed:<\/strong> Architecture can be scaled to handle large deployments and complex experiments.<\/li>\n\n\n\n<li><strong>Extensible:<\/strong> Supports custom scripting and integrations for tailored testing needs.<\/li>\n\n\n\n<li><strong>Open-source:<\/strong> Encourages community contributions and fosters innovation.<\/li>\n<\/ul>\n\n\n\n<p>This is a high-level overview. The actual architecture might have additional components and functionalities depending on specific configurations and integrations.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">How to Install Litmus Chaos it?<\/h2>\n\n\n\n<p>Installing Litmus Chaos offers several options to cater to your environment and preferences. Here&#8217;s a breakdown of the available methods:<\/p>\n\n\n\n<p><strong>1. Helm:<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Recommended for most users, offering ease of installation and management.<\/li>\n\n\n\n<li>Add the Litmus Chaos Helm repository:<\/li>\n<\/ul>\n\n\n\n<p>Bash<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-1\" data-shcb-language-name=\"JavaScript\" data-shcb-language-slug=\"javascript\"><span><code class=\"hljs language-javascript\">helm repo add litmuschaos https:<span class=\"hljs-comment\">\/\/litmuschaos.github.io\/litmus-helm\/<\/span>\nhelm repo update\n<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-1\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">JavaScript<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">javascript<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<ul class=\"wp-block-list\">\n<li>Install Litmus Chaos with your desired configuration:<\/li>\n<\/ul>\n\n\n\n<p>Bash<\/p>\n\n\n<pre class=\"wp-block-code\"><span><code class=\"hljs\">helm install chaos litmuschaos\/litmus --namespace litmus --values values.yaml\n<\/code><\/span><\/pre>\n\n\n<ul class=\"wp-block-list\">\n<li>Modify the <code class=\"\">values.yaml<\/code> file for customizations like namespace, image registry, and resource requests.<\/li>\n<\/ul>\n\n\n\n<p><strong>2. kubectl:<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Download the Litmus Chaos manifest YAML files from the GitHub releases page: https:\/\/github.com\/litmuschaos\/litmus<\/li>\n\n\n\n<li>Apply the manifests to your Kubernetes cluster using <code class=\"\">kubectl apply<\/code>:<\/li>\n<\/ul>\n\n\n\n<p>Bash<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-2\" data-shcb-language-name=\"HTML, XML\" data-shcb-language-slug=\"xml\"><span><code class=\"hljs language-xml\">kubectl apply -f <span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">path-to-manifests<\/span>&gt;<\/span>\/litmus*.yaml\n<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-2\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">HTML, XML<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">xml<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<ul class=\"wp-block-list\">\n<li>Replace <code class=\"\">&lt;path-to-manifests&gt;<\/code> with the directory where you downloaded the manifests.<\/li>\n<\/ul>\n\n\n\n<p><strong>3. Docker Compose (for testing):<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Download the Litmus Chaos Docker Compose YAML file from their official site.<\/li>\n\n\n\n<li>Run the Docker Compose command to deploy Litmus Chaos and a sample application:<\/li>\n<\/ul>\n\n\n\n<p>Bash<\/p>\n\n\n<pre class=\"wp-block-code\"><span><code class=\"hljs\">docker-compose up -d\n<\/code><\/span><\/pre>\n\n\n<p><strong>4. Cloud Providers:<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Some cloud providers offer managed Litmus Chaos services, simplifying deployment and management.<\/li>\n\n\n\n<li>Check the documentation for specific instructions on your chosen platform.<\/li>\n<\/ul>\n\n\n\n<p><strong>Tips:<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Start with a basic installation and gradually expand and configure as needed.<\/li>\n\n\n\n<li>Choose the method that best suits your skills and environment.<\/li>\n\n\n\n<li>Always test your installations in a non-production environment before deploying to production.<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">Basic Tutorials of Litmus Chaos: Getting Started<\/h2>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-large is-resized\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"576\" src=\"https:\/\/www.devopsschool.com\/blog\/wp-content\/uploads\/2024\/01\/image-407-1024x576.png\" alt=\"\" class=\"wp-image-42840\" style=\"width:649px;height:auto\" srcset=\"https:\/\/www.devopsschool.com\/blog\/wp-content\/uploads\/2024\/01\/image-407-1024x576.png 1024w, https:\/\/www.devopsschool.com\/blog\/wp-content\/uploads\/2024\/01\/image-407-300x169.png 300w, https:\/\/www.devopsschool.com\/blog\/wp-content\/uploads\/2024\/01\/image-407-768x432.png 768w, https:\/\/www.devopsschool.com\/blog\/wp-content\/uploads\/2024\/01\/image-407-1536x864.png 1536w, https:\/\/www.devopsschool.com\/blog\/wp-content\/uploads\/2024\/01\/image-407-355x199.png 355w, https:\/\/www.devopsschool.com\/blog\/wp-content\/uploads\/2024\/01\/image-407.png 1600w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><figcaption class=\"wp-element-caption\"><strong><em>Basic Tutorials of Litmus Chaos<\/em><\/strong><\/figcaption><\/figure>\n<\/div>\n\n\n<p>Welcome to the world of Litmus Chaos! Here are some stepwise tutorials to guide you through basic chaos injections in your Kubernetes environment:<\/p>\n\n\n\n<p><strong>1. Pod Chaos Tutorial:<\/strong><\/p>\n\n\n\n<p><strong>a. Prerequisites:<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Kubernetes cluster with kubectl access<\/li>\n\n\n\n<li>Helm v3 installed<\/li>\n<\/ul>\n\n\n\n<p><strong>b. Install Litmus Chaos:<\/strong><\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>Add the Litmus Chaos repository:<\/li>\n<\/ol>\n\n\n\n<p>Bash<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-3\" data-shcb-language-name=\"JavaScript\" data-shcb-language-slug=\"javascript\"><span><code class=\"hljs language-javascript\">helm repo add litmuschaos https:<span class=\"hljs-comment\">\/\/charts.litmuschaos.io<\/span>\n<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-3\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">JavaScript<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">javascript<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<ol class=\"wp-block-list\" start=\"2\">\n<li>Update the repository:<\/li>\n<\/ol>\n\n\n\n<p>Bash<\/p>\n\n\n<pre class=\"wp-block-code\"><span><code class=\"hljs\">helm repo update\n<\/code><\/span><\/pre>\n\n\n<ol class=\"wp-block-list\" start=\"3\">\n<li>Install Litmus Chaos using Helm:<\/li>\n<\/ol>\n\n\n\n<p>Bash<\/p>\n\n\n<pre class=\"wp-block-code\"><span><code class=\"hljs\">helm install litmus litmuschaos\/litmus\n<\/code><\/span><\/pre>\n\n\n<p><strong>c. Verify Installation:<\/strong><\/p>\n\n\n\n<p>Bash<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-4\" data-shcb-language-name=\"JavaScript\" data-shcb-language-slug=\"javascript\"><span><code class=\"hljs language-javascript\">kubectl <span class=\"hljs-keyword\">get<\/span> pods -n litmus\n<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-4\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">JavaScript<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">javascript<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p>You should see pods running for various Litmus Chaos components.<\/p>\n\n\n\n<p><strong>d. Choose a Chaos Experiment:<\/strong><\/p>\n\n\n\n<p>Head over to the ChaosHub officialsite to browse pre-built experiments:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Select the &#8220;pod-chaos&#8221; experiment and download its YAML manifest.<\/li>\n<\/ul>\n\n\n\n<p><strong>e. Modify the Experiment (Optional):<\/strong><\/p>\n\n\n\n<p>The downloaded manifest defines the experiment parameters:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>target_namespaces:<\/strong> Specify the namespace(s) where pods will be crashed (default: all namespaces).<\/li>\n\n\n\n<li><strong>percentage:<\/strong> Define the percentage of pods to be crashed within the target namespace(s).<\/li>\n\n\n\n<li><strong>duration:<\/strong> Set the experiment duration in seconds.<\/li>\n<\/ul>\n\n\n\n<p>Adjust these parameters as needed based on your desired chaos scenario.<\/p>\n\n\n\n<p><strong>f. Apply the Experiment:<\/strong><\/p>\n\n\n\n<p>Run the following command, replacing <code class=\"\">pod-chaos-experiment.yaml<\/code> with your adjusted manifest filename:<\/p>\n\n\n\n<p>Bash<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-5\" data-shcb-language-name=\"CSS\" data-shcb-language-slug=\"css\"><span><code class=\"hljs language-css\"><span class=\"hljs-selector-tag\">kubectl<\/span> <span class=\"hljs-selector-tag\">apply<\/span> <span class=\"hljs-selector-tag\">-f<\/span> <span class=\"hljs-selector-tag\">pod-chaos-experiment<\/span><span class=\"hljs-selector-class\">.yaml<\/span>\n<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-5\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">CSS<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">css<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p><strong>g. Observe the Chaos:<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Pods in the specified namespaces will be randomly crashed based on the experiment settings.<\/li>\n\n\n\n<li>Monitor your application&#8217;s behavior and resilience during the experiment duration.<\/li>\n<\/ul>\n\n\n\n<p><strong>h. Clean Up:<\/strong><\/p>\n\n\n\n<p>Once the experiment duration is complete, delete the experiment:<\/p>\n\n\n\n<p>Bash<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-6\" data-shcb-language-name=\"JavaScript\" data-shcb-language-slug=\"javascript\"><span><code class=\"hljs language-javascript\">kubectl <span class=\"hljs-keyword\">delete<\/span> chaosexperiment pod-chaos-experiment\n<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-6\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">JavaScript<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">javascript<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p><strong>2. Network Loss Tutorial:<\/strong><\/p>\n\n\n\n<p><strong>a. Choose a Chaos Experiment:<\/strong><\/p>\n\n\n\n<p>Navigate to the ChaosHub and choose the &#8220;network-chaos&#8221; experiment. Download its YAML manifest.<\/p>\n\n\n\n<p><strong>b. Modify the Experiment (Optional):<\/strong><\/p>\n\n\n\n<p>Similar to the pod chaos experiment, adjust the:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>target_namespaces:<\/strong> Specify the namespace(s) where network loss will be injected.<\/li>\n\n\n\n<li><strong>percentage:<\/strong> Define the percentage of pods affected by network loss within the target namespace(s).<\/li>\n\n\n\n<li><strong>loss_percentage:<\/strong> Set the desired network loss percentage for affected pods.<\/li>\n\n\n\n<li><strong>duration:<\/strong> Set the experiment duration in seconds.<\/li>\n<\/ul>\n\n\n\n<p>Fine-tune these parameters to fit your desired chaos scenario.<\/p>\n\n\n\n<p><strong>c. Apply the Experiment:<\/strong><\/p>\n\n\n\n<p>Run the following command, replacing <code class=\"\">network-chaos-experiment.yaml<\/code> with your adjusted manifest filename:<\/p>\n\n\n\n<p>Bash<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-7\" data-shcb-language-name=\"CSS\" data-shcb-language-slug=\"css\"><span><code class=\"hljs language-css\"><span class=\"hljs-selector-tag\">kubectl<\/span> <span class=\"hljs-selector-tag\">apply<\/span> <span class=\"hljs-selector-tag\">-f<\/span> <span class=\"hljs-selector-tag\">network-chaos-experiment<\/span><span class=\"hljs-selector-class\">.yaml<\/span>\n<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-7\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">CSS<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">css<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p><strong>d. Observe the Chaos:<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Pods in the specified namespaces will experience network loss, impacting their communication and functionality.<\/li>\n\n\n\n<li>Monitor your application&#8217;s behavior and resilience under network disruption.<\/li>\n<\/ul>\n\n\n\n<p><strong>e. Clean Up:<\/strong><\/p>\n\n\n\n<p>Once the experiment concludes, delete it:<\/p>\n\n\n\n<p>Bash<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-8\" data-shcb-language-name=\"JavaScript\" data-shcb-language-slug=\"javascript\"><span><code class=\"hljs language-javascript\">kubectl <span class=\"hljs-keyword\">delete<\/span> chaosexperiment network-chaos-experiment\n<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-8\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">JavaScript<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">javascript<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p><strong>Bonus Tips:<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Explore the ChaosHub for various pre-built experiments targeting different chaos types like disk stress, CPU throttling, and more.<\/li>\n\n\n\n<li>Consider starting with simple experiments in non-critical environments before introducing chaos to production systems.<\/li>\n\n\n\n<li>Utilize the Litmus Chaos web UI for a visual overview of your experiments and system behavior under stress.<\/li>\n<\/ul>\n\n\n\n<p>Always remember, chaos engineering is about proactively testing your system&#8217;s resilience. These tutorials provide a stepping stone for your journey with Litmus Chaos. Have fun experimenting and building robust, resilient Kubernetes environments!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>What is Litmus Chaos? Litmus Chaos is an end-to-end Chaos Engineering platform specifically designed for cloud-native environments. It empowers you to inject controlled chaos into your applications and infrastructure, uncovering&#8230; <\/p>\n","protected":false},"author":41,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_joinchat":[],"footnotes":""},"categories":[2],"tags":[],"class_list":["post-42827","post","type-post","status-publish","format-standard","hentry","category-uncategorised"],"_links":{"self":[{"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/posts\/42827","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/users\/41"}],"replies":[{"embeddable":true,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/comments?post=42827"}],"version-history":[{"count":1,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/posts\/42827\/revisions"}],"predecessor-version":[{"id":42841,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/posts\/42827\/revisions\/42841"}],"wp:attachment":[{"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/media?parent=42827"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/categories?post=42827"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/tags?post=42827"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}