<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: OUM NIVRATHI KALE</title>
    <description>The latest articles on DEV Community by OUM NIVRATHI KALE (@oumkale).</description>
    <link>https://dev.to/oumkale</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F408599%2Fb52d0948-6d2f-4712-ad10-f69e1889caec.jpeg</url>
      <title>DEV Community: OUM NIVRATHI KALE</title>
      <link>https://dev.to/oumkale</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/oumkale"/>
    <language>en</language>
    <item>
      <title>Create Chaos Experiments Using the LitmusChaos Python SDK</title>
      <dc:creator>OUM NIVRATHI KALE</dc:creator>
      <pubDate>Wed, 15 Sep 2021 10:52:02 +0000</pubDate>
      <link>https://dev.to/oumkale/create-chaos-experiments-using-the-litmuschaos-python-sdk-4492</link>
      <guid>https://dev.to/oumkale/create-chaos-experiments-using-the-litmuschaos-python-sdk-4492</guid>
      <description>&lt;h2&gt;
  
  
  Hello, now LitmusChaos is supporting the python experiments…
&lt;/h2&gt;

&lt;p&gt;Let’s see how to create chaos using a python SDK without losing time, step by step. &lt;/p&gt;

&lt;p&gt;Before we get started big announcement is LitmusChaos 2.0 is out and litmus-python is also a part if it. &lt;/p&gt;

&lt;p&gt;I'm focusing on creating chaos, so if you want to know more about Chaos Engineering then please follow &lt;a href="https://litmuschaos.io/" rel="noopener noreferrer"&gt;LitmusChaos&lt;/a&gt; and details regarding Python SDK &lt;a href="https://github.com/litmuschaos/litmus-python/tree/master/contribute/developer-guide" rel="noopener noreferrer"&gt;litmus-python&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Setup python environment (optinal):&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;python3 -m virtualenv chaos&lt;/li&gt;
&lt;li&gt;source chaos/bin/activate&lt;/li&gt;
&lt;li&gt;python3 -m pip install -r requirements.txt
You may face some errors, if python version is different. Please manually fix it.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Steps to create Chaos:
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;git clone &lt;a href="https://github.com/litmuschaos/litmus-python.git" rel="noopener noreferrer"&gt;https://github.com/litmuschaos/litmus-python.git&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;cd contribute/developer-guide&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Now update your &lt;code&gt;attributes.yaml&lt;/code&gt; manifest. Like the name, category, etc. but follow: &lt;code&gt;Use _ in&lt;/code&gt; names eg: &lt;code&gt;sample_category&lt;/code&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Now run: &lt;code&gt;python3 generate_experiment.py -f=attributes.yaml -g="generate-type" -t="type"&lt;/code&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Run both commands&lt;/li&gt;
&lt;li&gt;For Experiment: python3 generate_experiment.py -f=attributes.yaml -g=experiment&lt;/li&gt;
&lt;li&gt;For Charts : python3 generate_experiment.py -f=attributes.yaml -g=chart -t="all"
&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;
Note: Replace the -g=&amp;lt;generate-type&amp;gt; placeholder with the appropriate value based on the usecase:

 - experiment: Chaos experiment artifacts belonging to an existing OR new experiment.
 - chart: Just the chaos-chart metadata, i.e., chartserviceversion.yaml

Provide the type of chart in the `-t=&amp;lt;type&amp;gt;` flag. It supports the following values:
 - category: It creates the chart metadata for the category i.e chartserviceversion, package manifests
 - experiment: It creates the chart for the experiment i.e chartserviceversion, engine, rbac, experiment manifests
 - all: it creates both category and experiment charts (default type)
Provide the path of the attribute.yaml manifest in the -f flag.

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Check: &lt;code&gt;chaosLib/litmus/&lt;/code&gt;, &lt;code&gt;experiments/&lt;/code&gt; and &lt;code&gt;pkg/&lt;/code&gt; directories. Sample chaos has been generated.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Open &lt;code&gt;bin/experiment/experiment.py&lt;/code&gt; and&lt;br&gt;
&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import experiments.sample_category.sample_exec_chaos.experiment.sample_exec_chaos as experiment
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;(sample_exec_experimet and sample_exec_chaos will be your provided names in attribute.yaml manifest, Default one mentioned everywhere) and add one more &lt;code&gt;elif&lt;/code&gt; condition&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;elif args.name == "chaos":
    experiment.Experiment(clients)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Add directories in setup.py
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;'chaosLib/litmus/sample_exec_chaos',
'chaosLib/litmus/sample_exec_chaos/lib',
'pkg/sample_category',
'pkg/sample_category/environment',
'pkg/sample_category/types',
'experiments/sample_category',
'experiments/sample_category/sample_exec_chaos',
'experiments/sample_category/sample_exec_chaos/experiment',
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;I've updated default names.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Let’s come back to root directory &lt;code&gt;litmuschaos/litmus-python&lt;/code&gt; to setup environment.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;python3 setup.py install (You need to run this every time before running &lt;code&gt;python3 experiment.py -name chaos&lt;/code&gt;, Installing all required &lt;br&gt;
prerequisites and setting up directory structure) &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Now ready to code, Just open &lt;code&gt;chaosLib/litmus/sample_exec_chaos/lib/&lt;/code&gt; &lt;code&gt;sample_exec_chaos.py&lt;/code&gt; and &lt;code&gt;experiments/sample_category/sample_exec_chaos/experiment/sample_exec_chaos.py&lt;/code&gt; files and start writing chaos…&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Create a sample Nginx deployment that can be used as the application under test (AUT).&lt;br&gt;
&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;kubectl create deployment nginx --image=nginx
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Go to pkg/sample_category and open the environment.py or types.py and add/delete/update the required env.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Note:&lt;br&gt;
    Add &lt;code&gt;&amp;amp;&lt;/code&gt; operator at the end of chaos commands &lt;code&gt;CHAOS_INJECT_COMMAND&lt;/code&gt;&lt;br&gt;
 example: &lt;code&gt;md5sum /dev/zero &amp;amp;&lt;/code&gt;. As we are running chaos commands as a background process in a separate thread.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Go to bin/experiment and run: &lt;code&gt;python3 experiment.py -name chaos&lt;/code&gt;. 
Before this command always run &lt;code&gt;python3 setup.py install&lt;/code&gt; in the root directory.
Example chaos logs:
&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;time=2021-08-13 11:43:12,392 level=INFO  msg=Experiment Name: chaos
time=2021-08-13 11:43:12,392 level=INFO  msg=[PreReq]: Initialise Chaos Variables for the sample-chaos experiment
time=2021-08-13 11:43:12,393 level=INFO  msg=[PreReq]: Updating the chaos result of sample-chaos experiment (SOT)
time=2021-08-13 11:43:12,867 level=INFO  msg=[Info]: The application information is as follows Namespace=litmus, Label=app=nginx, Ramp Time=0
time=2021-08-13 11:43:12,867 level=INFO  msg=[Status]: Verify that the AUT (Application Under Test) is running (pre-chaos)
time=2021-08-13 11:43:12,867 level=INFO  msg=[status]: Checking whether application containers are in ready state
time=2021-08-13 11:43:12,887 level=INFO  msg=[status]: The Container status are as follows Container : nginx, Pod : nginx-66b6c48dd5-c65kl, Readiness : True
time=2021-08-13 11:43:12,887 level=INFO  msg=[status]: The Container status are as follows Container : nginx, Pod : nginx-66b6c48dd5-p87pc, Readiness : True
time=2021-08-13 11:43:12,887 level=INFO  msg=[status]: The Container status are as follows Container : nginx, Pod : nginx-66b6c48dd5-s5hjs, Readiness : True
time=2021-08-13 11:43:12,887 level=INFO  msg=[status]: Checking whether application pods are in running state
time=2021-08-13 11:43:12,908 level=INFO  msg=[status]: The status of Pods are as follows Pod : nginx-66b6c48dd5-c65kl status : Running
time=2021-08-13 11:43:12,908 level=INFO  msg=[status]: The status of Pods are as follows Pod : nginx-66b6c48dd5-p87pc status : Running
time=2021-08-13 11:43:12,908 level=INFO  msg=[status]: The status of Pods are as follows Pod : nginx-66b6c48dd5-s5hjs status : Running
time=2021-08-13 11:43:12,938 level=INFO  msg=[Info]: chaos candidate of kind: deployment, name: nginx, namespace: litmus
time=2021-08-13 11:43:12,943 level=INFO  msg=[Info]: chaos candidate of kind: deployment, name: nginx, namespace: litmus
time=2021-08-13 11:43:12,947 level=INFO  msg=[Info]: chaos candidate of kind: deployment, name: nginx, namespace: litmus
time=2021-08-13 11:43:12,947 level=INFO  msg=[Chaos]:Number of pods targeted: 3
time=2021-08-13 11:43:12,947 level=INFO  msg=[Info]: Target pods list, ['nginx-66b6c48dd5-c65kl', 'nginx-66b6c48dd5-p87pc', 'nginx-66b6c48dd5-s5hjs']
time=2021-08-13 11:43:12,955 level=INFO  msg=[Chaos]: The Target application details container : nginx, Pod : nginx-66b6c48dd5-c65kl
time=2021-08-13 11:43:12,956 level=INFO  msg=[Chaos]: Waiting for: 10
time=2021-08-13 11:43:22,955 level=INFO  msg=[Chaos]: Time is up for experiment: sample-chaos
time=2021-08-13 11:43:23,155 level=INFO  msg=[Chaos]: The Target application details container : nginx, Pod : nginx-66b6c48dd5-p87pc
time=2021-08-13 11:43:23,164 level=INFO  msg=[Chaos]: Waiting for: 10
time=2021-08-13 11:43:33,155 level=INFO  msg=[Chaos]: Time is up for experiment: sample-chaos
time=2021-08-13 11:43:33,289 level=INFO  msg=[Chaos]: The Target application details container : nginx, Pod : nginx-66b6c48dd5-s5hjs
time=2021-08-13 11:43:33,289 level=INFO  msg=[Chaos]: Waiting for: 10
time=2021-08-13 11:43:43,289 level=INFO  msg=[Chaos]: Time is up for experiment: sample-chaos
time=2021-08-13 11:43:43,405 level=INFO  msg=[Confirmation]: sample-chaos chaos has been injected successfully
time=2021-08-13 11:43:43,405 level=INFO  msg=[Status]: Verify that the AUT (Application Under Test) is running (post-chaos)
time=2021-08-13 11:43:43,405 level=INFO  msg=[status]: Checking whether application containers are in ready state
time=2021-08-13 11:43:43,416 level=INFO  msg=[status]: The Container status are as follows Container : nginx, Pod : nginx-66b6c48dd5-c65kl, Readiness : True
time=2021-08-13 11:43:43,416 level=INFO  msg=[status]: The Container status are as follows Container : nginx, Pod : nginx-66b6c48dd5-p87pc, Readiness : True
time=2021-08-13 11:43:43,416 level=INFO  msg=[status]: The Container status are as follows Container : nginx, Pod : nginx-66b6c48dd5-s5hjs, Readiness : True
time=2021-08-13 11:43:43,416 level=INFO  msg=[status]: Checking whether application pods are in running state
time=2021-08-13 11:43:43,429 level=INFO  msg=[status]: The status of Pods are as follows Pod : nginx-66b6c48dd5-c65kl status : Running
time=2021-08-13 11:43:43,429 level=INFO  msg=[status]: The status of Pods are as follows Pod : nginx-66b6c48dd5-p87pc status : Running
time=2021-08-13 11:43:43,429 level=INFO  msg=[status]: The status of Pods are as follows Pod : nginx-66b6c48dd5-s5hjs status : Running
time=2021-08-13 11:43:43,429 level=INFO  msg=[The End]: Updating the chaos result of sample-chaos experiment (EOT)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;ul&gt;
&lt;li&gt;Now make sure that you have created all the required charts. In directory &lt;code&gt;experiments/sample_category/sample_exec_chaos/charts&lt;/code&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;h2&gt;
  
  
  After testing locally now let’s go into production.
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Go to the root directory &lt;code&gt;litmuschaos/litmus-python&lt;/code&gt;. Build a docker image: docker build -t your-user-name/py-runner:ci . and push it &lt;code&gt;docker push your-user-name/py-runner:ci&lt;/code&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;h2&gt;
  
  
  Two ways to test it:
&lt;/h2&gt;
&lt;h3&gt;
  
  
  1. Use custom way
&lt;/h3&gt;

&lt;p&gt;Refer docs for more details &lt;a href="https://github.com/litmuschaos/litmus-python/tree/master/contribute/developer-guide" rel="noopener noreferrer"&gt;python-sdk&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Run the experiment.yml with the desired values in the ENV and appropriate chaosServiceAccount using a custom dev image instead of &lt;code&gt;litmuschaos/litmus-python&lt;/code&gt; (say, &lt;code&gt;oumkale/litmus-python:ci&lt;/code&gt;) that packages the business logic.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Create a custom image built with the code validated by the previous steps.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Launch the Chaos-Operator:&lt;br&gt;
&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;kubectl apply -f https://litmuschaos.github.io/litmus/litmus-operator-v1.13.8.yaml
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;ul&gt;
&lt;li&gt;Setup the RBAC necessary for the execution of this experiment by applying the generated &lt;code&gt;rbac.yaml&lt;/code&gt;.
&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;kubectl apply -f rbac.yaml
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Modify the ChaosExperiment manifest (experiment.yaml) with right defaults (env &amp;amp; other attributes, as applicable) &amp;amp; create this CR on the cluster (pointing the .spec.definition.image to the custom one just built).&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Modify the ChaosEngine manifest (engine.yaml) with the right app details, run properties &amp;amp; creating this CR to launch the chaos pods.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Verify the experiment status via ChaosResult.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Refer &lt;a href="https://docs.litmuschaos.io/docs/getstarted/" rel="noopener noreferrer"&gt;litmus docs&lt;/a&gt; for more details on performing each step in this procedure.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;Run all the CRs and operator in the single namespace&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Example &lt;code&gt;experiment.yaml&lt;/code&gt;: &lt;a href="https://raw.githubusercontent.com/oumkale/notes/main/sdk-experiment.yaml" rel="noopener noreferrer"&gt;Link&lt;/a&gt; &lt;br&gt;
Example &lt;code&gt;engine.yaml&lt;/code&gt;: &lt;a href="https://raw.githubusercontent.com/oumkale/notes/main/sdk-engine.yaml" rel="noopener noreferrer"&gt;Link&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;N/b: Also use &lt;code&gt;&amp;amp;&lt;/code&gt; operator at last if any chaos command is required as an ENV.&lt;/p&gt;

&lt;p&gt;Now list the pods in the namespace&lt;br&gt;
If engine pod is running with runner&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;nginx-chaos-runner                      1/1     Running   0          35s
pod-cpu-hog-exec-2szc9z-rjjkr           1/1     Running   0          33s
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;See the logs of the engine pod.&lt;/p&gt;

&lt;h3&gt;
  
  
  2. Using Litmus Portal
&lt;/h3&gt;

&lt;p&gt;Follow this &lt;a href="https://github.com/litmuschaos/litmus/tree/master/litmus-portal" rel="noopener noreferrer"&gt;Link&lt;/a&gt; for portal setup details.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Open portal and go to &lt;code&gt;Workflows&lt;/code&gt; -&amp;gt; &lt;code&gt;Schedule a workflow&lt;/code&gt;&lt;br&gt;
&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fh244tzeq1boa58p81wyy.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fh244tzeq1boa58p81wyy.png" alt="Alt Text" width="800" height="118"&gt;&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Select your agent.&lt;br&gt;
&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fedk3hou37u9929jitd2f.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fedk3hou37u9929jitd2f.png" alt="Alt Text" width="597" height="80"&gt;&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;You may select 2nd one experiment from my hub as well.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Use upload YAML. (For workflow example: &lt;a href="https://raw.githubusercontent.com/oumkale/notes/main/sdk.yaml" rel="noopener noreferrer"&gt;Link&lt;/a&gt;). n/b: Here need to upload argo workflow.&lt;br&gt;
&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fxgsz4h420kgbnmbx26nt.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fxgsz4h420kgbnmbx26nt.png" alt="Alt Text" width="800" height="455"&gt;&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;On selecting next-next you will land on this page where you can edit YAML or you may update using UI only on clicking &lt;code&gt;Name&lt;/code&gt;, which will land on the next screen.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Update engine &lt;code&gt;spec.chaosServiceAccount: litmus-admin&lt;/code&gt; &lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fa7gx6shgf8ylztttyg3f.png" alt="Alt Text" width="800" height="323"&gt;
&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;li&gt;&lt;p&gt;Now tune all the ENV and finish &lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F5rnlovr3xkys25ef8nla.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F5rnlovr3xkys25ef8nla.png" alt="Alt Text" width="800" height="448"&gt;&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;

&lt;li&gt;&lt;p&gt;After scheduling workflow you will land on the workflow dashboard.&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fcc5yhflwy3iaikyis6eg.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fcc5yhflwy3iaikyis6eg.png" alt="Alt Text" width="800" height="98"&gt;&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;

&lt;li&gt;&lt;p&gt;Open Workflow to see details.&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fsdw99zfhfcl9ee5t248w.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fsdw99zfhfcl9ee5t248w.png" alt="Alt Text" width="800" height="274"&gt;&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;

&lt;/ul&gt;

&lt;p&gt;Here Logs, Chaos Results, and details about the experiment have been proved, Hence you have completed creating Chaos and testing on the application.&lt;/p&gt;

&lt;p&gt;Note: You can see details in UI, but another way is to describe the following CRs.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;kubectl get chaosresult -n litmus&lt;/code&gt;&lt;br&gt;
&lt;code&gt;kubectl get chaosengine -n litmus&lt;/code&gt;&lt;br&gt;
&lt;code&gt;kubectl get chaosexperiment -n litmus&lt;/code&gt;&lt;br&gt;
&lt;code&gt;kubectl get workflow -n litmus&lt;/code&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Congratulation You have been successfully Created and Injected Chaos!
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Now it's time to raise PR...!
&lt;/h3&gt;

&lt;p&gt;Steps to Include the Chaos Charts/Experiments into the ChartHub:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Send a PR to the &lt;a href="https://github.com/litmuschaos/litmus-python/tree/master/contribute/developer-guide" rel="noopener noreferrer"&gt;litmus-python&lt;/a&gt; repo with the modified experiment files, rbac, test deployment &amp;amp; README.&lt;/li&gt;
&lt;li&gt;Send a PR to the &lt;a href="https://github.com/litmuschaos/chaos-charts/tree/master/charts/generic" rel="noopener noreferrer"&gt;chaos-charts&lt;/a&gt; repo with the modified experiment CR, experiment chartserviceversion, rbac, (category-level) chaos chart chartserviceversion &amp;amp; package.yaml (if applicable).&lt;/li&gt;
&lt;li&gt;Contact us on slack for any queries or doubts.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Are you an SRE or a Kubernetes enthusiast? Does Chaos Engineering excite you?
&lt;/h3&gt;

&lt;p&gt;Join the LitmusChaos Community Slack channel by joining the &lt;code&gt;#litmus&lt;/code&gt; channel on the Kubernetes (&lt;a href="https://slack.k8s.io/" rel="noopener noreferrer"&gt;https://slack.k8s.io/&lt;/a&gt;) Slack!&lt;/p&gt;

&lt;h3&gt;
  
  
  References:
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://kubernetes.slack.com/archives/CNXNB0ZTN" rel="noopener noreferrer"&gt;Slack&lt;/a&gt;&lt;br&gt;
&lt;a href="https://litmuschaos.io/" rel="noopener noreferrer"&gt;LitmusChaos Website&lt;/a&gt;&lt;br&gt;
&lt;a href="https://hub.litmuschaos.io/" rel="noopener noreferrer"&gt;Litmus ChaosHub&lt;/a&gt;&lt;br&gt;
&lt;a href="https://github.com/litmuschaos/litmus" rel="noopener noreferrer"&gt;Github Repo Litmus&lt;/a&gt;&lt;br&gt;
&lt;a href="https://github.com/litmuschaos/litmus-python/tree/master/contribute/developer-guide" rel="noopener noreferrer"&gt;litmus-python&lt;/a&gt;&lt;br&gt;
&lt;a href="https://kubernetes.slack.com/?redir=%2Farchives%2FCNXNB0ZTN" rel="noopener noreferrer"&gt;Connect with us on Slack&lt;/a&gt;&lt;br&gt;
&lt;a href="https://github.com/litmuschaos/chaos-charts/tree/master/charts/generic" rel="noopener noreferrer"&gt;chaos-charts&lt;/a&gt;&lt;br&gt;
&lt;a href="https://www.youtube.com/channel/UCa57PMqmz_j0wnteRa9nCaw" rel="noopener noreferrer"&gt;Litmus Chaos YouTube Channel&lt;/a&gt;&lt;/p&gt;

</description>
      <category>kubernetes</category>
      <category>docker</category>
      <category>python</category>
    </item>
    <item>
      <title>Banking Failures And Overcoming using LitmusChaos</title>
      <dc:creator>OUM NIVRATHI KALE</dc:creator>
      <pubDate>Fri, 13 Aug 2021 13:44:14 +0000</pubDate>
      <link>https://dev.to/oumkale/banking-failures-and-overcoming-using-litmuschaos-172n</link>
      <guid>https://dev.to/oumkale/banking-failures-and-overcoming-using-litmuschaos-172n</guid>
      <description>&lt;h2&gt;
  
  
  Hey everyone, in this blog, I am going to talk about banking-related failures and how we can overcome them using LitmusChaos.
&lt;/h2&gt;

&lt;p&gt;Have you ever come across a banking failure?&lt;/p&gt;

&lt;p&gt;Today due to mobile banking apps, for instance, allow you to deposit checks from the comfort of anywhere. At the same time, you can check your balance, transfer funds, and set up a notification to alert you if you overdraft your account without a need to visit a branch. It is a real time-saver! &lt;br&gt;
But at the same time, if the bank’s server is down or the connection is slow, you would not be able to access your accounts, and it would be difficult to know if your transaction went through.&lt;/p&gt;
&lt;h3&gt;
  
  
  We will be going through the following topics one by one:
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;Bank Of Anthos&lt;/code&gt; and its relation with LitmusChaos&lt;/li&gt;
&lt;li&gt;Bank-Of-Anthos-Resiliency Workflow&lt;/li&gt;
&lt;li&gt;Getting Started with Litmus&lt;/li&gt;
&lt;li&gt;Injecting Chaos and observing results.&lt;/li&gt;
&lt;li&gt;Conclusion, References, and Links.&lt;/li&gt;
&lt;/ul&gt;
&lt;h2&gt;
  
  
  About Bank Of Anthos and its relation with LitmusChaos
&lt;/h2&gt;

&lt;p&gt;&lt;code&gt;Bank of Anthos&lt;/code&gt; is a sample HTTP-based web app that simulates a bank's payment processing network, allowing users to create artificial bank accounts and complete transactions.&lt;br&gt;
Google uses this application to demonstrate how developers can modernize enterprise applications using GCP products.&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--9Ev7AWoD--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/o7hgh5f6wtpb63040p2u.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--9Ev7AWoD--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/o7hgh5f6wtpb63040p2u.png" alt="Alt Text"&gt;&lt;/a&gt;The architecture of Bank Of Anthos&lt;/p&gt;

&lt;p&gt;In LitmusChaos, we have been working and testing our experiments on &lt;code&gt;Bank Of Anthos&lt;/code&gt; applications. Chaos Experiments contain the actual chaos details.&lt;br&gt;
We have two scenarios: weak and resilient. Based on that, we will perform our experiment workloads and try to find an effect on the cause.&lt;/p&gt;

&lt;p&gt;This workflow allows the execution of the same chaos experiment against two versions of the &lt;code&gt;bank-of-anthos deployment&lt;/code&gt;: the weak ones are expected to fail while the resilient ones succeed, essentially highlighting the need for deployment best-practice.&lt;/p&gt;
&lt;h2&gt;
  
  
  Getting Started with Litmus
&lt;/h2&gt;

&lt;p&gt;Litmus is an open-source Chaos Engineering platform that enables teams to identify weaknesses &amp;amp; potential outages in infrastructures by inducing chaos tests in a controlled way.&lt;/p&gt;

&lt;p&gt;Developers &amp;amp; SREs can execute Chaos Engineering with Litmus as it is easy to use, based on modern chaos engineering practices &amp;amp; community collaboration. Litmus is 100% open source &amp;amp; CNCF-hosted.&lt;/p&gt;

&lt;p&gt;Litmus takes a cloud-native approach to create, manage and monitor chaos. &lt;br&gt;
Chaos is orchestrated using the following Kubernetes Custom &lt;br&gt;
Resource Definitions (CRDs):&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;ChaosEngine: A resource to link a Kubernetes application or Kubernetes node to a ChaosExperiment. ChaosEngine is watched by the Chaos-Operator that invokes Chaos-Experiments.&lt;/li&gt;
&lt;li&gt;ChaosExperiment: A resource to group the configuration parameters of a chaos experiment. ChaosExperiment CRs are created by the operator when experiments are invoked by ChaosEngine.&lt;/li&gt;
&lt;li&gt;ChaosResult: A resource to hold the results of a chaos experiment. The Chaos-exporter reads the results and exports the metrics into a configured Prometheus server.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Chaos experiments are hosted on hub.litmuschaos.io. It is the central hub, where the application developers, vendors share their chaos experiments so that their users can use them to increase the resilience of the applications in production.&lt;/p&gt;
&lt;h2&gt;
  
  
  Injecting Chaos and observing results:
&lt;/h2&gt;

&lt;p&gt;&lt;code&gt;Pod-network-loss&lt;/code&gt; injects chaos to disrupt network connectivity to &lt;code&gt;balancereader&lt;/code&gt; &amp;amp; &lt;code&gt;transactionhistory&lt;/code&gt; Kubernetes pods.&lt;br&gt;
The application pod should be healthy once the workflow run is complete. Service requests should be served, despite the chaos. This experiment causes loss of access to application replica by injecting packet loss using litmus.&lt;/p&gt;

&lt;p&gt;Network loss is done on a &lt;code&gt;balancereader&lt;/code&gt; or &lt;code&gt;transactionhistory&lt;/code&gt; pod that reads from &lt;code&gt;ledger DB&lt;/code&gt; and runs as a single replica deployment and not as a multi-replica in weak scenarios. Due to loss, &lt;code&gt;balancereader&lt;/code&gt; and &lt;code&gt;transactionhistory&lt;/code&gt; are inaccessible (or Read-Only), resulting in failed requests.&lt;/p&gt;

&lt;p&gt;In a single replica deployment, the user is not able to - see the details, add the details or get information. Whereas in two deployments it is possible to add details. The &lt;code&gt;balancereader&lt;/code&gt; or &lt;code&gt;transactionhistory&lt;/code&gt; details can be added and retrieved via provided APIs.&lt;/p&gt;
&lt;h2&gt;
  
  
  Checking using the Probe:
&lt;/h2&gt;

&lt;p&gt;The HTTP probe allows developers to specify a URL that the experiment uses to gauge health/service availability (or other custom conditions) as part of the entry/exit criteria. The received status code is then mapped against an expected status. It can be defined at &lt;code&gt;.spec.experiments[].spec.probe&lt;/code&gt;, the path inside ChaosEngine.&lt;/p&gt;

&lt;p&gt;We have been using HTTP probe again front end URL &lt;code&gt;http://frontend.bank.svc.cluster.local:80&lt;/code&gt; with the probe poll interval of 1 second.&lt;/p&gt;

&lt;p&gt;We have been using HTTP probe again front end URL &lt;code&gt;“http://frontend.bank.svc.cluster.local:80”&lt;/code&gt; with probe poll interval 1 sec.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;- name: "check-frontend-access-url"
  type: "httpProbe"
  httpProbe/inputs:
    url: "http://frontend.bank.svc.cluster.local:80"
    insecureSkipVerify: false
    method:
      get:
        criteria: "=="
        responseCode: "200"
  mode: "Continuous"
  runProperties:
    probeTimeout: 2
    interval: 1
    retry: 2
    probePollingInterval: 1
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;&lt;p&gt;In a weak scenario, only one replica of the pod is present. After chaos injection, it will be down, and therefore accessibility will not be there, and eventually, it will fail due to frontend access.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;In a resilient scenario, two replicas of pods are present. After chaos injection, one will be down. Therefore, one pod is still up for accessibility and will still be there to pass due to frontend access.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The probe will retry for timeout duration for accessibility change. If the termination time exceeds the timeout without accessibility, it will fail.&lt;/p&gt;

&lt;h2&gt;
  
  
  Litmus Portal
&lt;/h2&gt;

&lt;p&gt;Litmus-Portal provides console and UI experience for managing, monitoring, and events around chaos workflows. Chaos workflows consist of a sequence of experiments run together to achieve the objective of introducing fault into an application or the Kubernetes platform.&lt;/p&gt;

&lt;h4&gt;
  
  
  Applying k8s manifest
&lt;/h4&gt;



&lt;p&gt;&lt;code&gt;kubectl apply -f https://raw.githubusercontent.com/litmuschaos/litmus/2.0.0-Beta9/docs/2.0.0-Beta/litmus-2.0.0-Beta.yaml&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;p&gt;After installation is complete, you can explore every part of the Chaos control plane and predefined workflows.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;You will find a similar screen like this.&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--yl8A9JsL--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/5q1alczmpaetf3kf6zby.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--yl8A9JsL--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/5q1alczmpaetf3kf6zby.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Open &lt;code&gt;Bank of Anthos&lt;/code&gt; predefined workflow to get the details.&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--sGLtJ5XQ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/dod6pk7x76u7i9su3ube.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--sGLtJ5XQ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/dod6pk7x76u7i9su3ube.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Now to schedule a workflow using a control plane, select the option.&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--s89VSTG6--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/gekhuar40s3o2otfqhzg.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--s89VSTG6--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/gekhuar40s3o2otfqhzg.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;You can edit YAML and see the app deployer:&lt;br&gt;
&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt; - name: install-application
      container:
        image: litmuschaos/litmus-app-deployer:latest
        args:
          - -namespace=bank
          - -typeName=resilient
          - -operation=apply
          - -timeout=400
          - -app=bank-of-anthos
          - -scope=cluster
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Here, in the application installation step for weak, you can change &lt;code&gt;-typeName=weak&lt;/code&gt; that results in a single replica.&lt;/p&gt;

&lt;p&gt;Note: Make sure you have passed the correct docker path in the ChaosEngine.&lt;br&gt;
Default: &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;name: SOCKET_PATH&lt;br&gt;
 value: /var/run/docker.sock&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--E36ctwvY--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/qpxhgpf19nw7ty6kr8yf.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--E36ctwvY--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/qpxhgpf19nw7ty6kr8yf.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Now let's continue and schedule a workflow. &lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;After the completion of the workflow run, we can see that there is a failure at network loss, that is probe failure due to weak application.&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--wFNtJmfM--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/vk1mzt0wkfux9gn2fhna.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--wFNtJmfM--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/vk1mzt0wkfux9gn2fhna.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;It can be cross-checked by using the UI. &lt;code&gt;http://&amp;lt;frontend-host&amp;gt;:portNo&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--eEd4P8V8--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/v3p2r9h4mewb28ruzfsp.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--eEd4P8V8--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/v3p2r9h4mewb28ruzfsp.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;We can see this in real-world scenarios also where we are unable to check our balance.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Now, let us schedule the workflow again using &lt;code&gt;-typeName=resilient&lt;/code&gt;
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--vh7NE4mV--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/w2hlrvh0llvrd6jcfjv8.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--vh7NE4mV--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/w2hlrvh0llvrd6jcfjv8.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;We can see that the application has passed even after network loss. Due to the high availability of replicas, the probe has passed.&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--L24yIETv--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/2tzdu5myadd95do8rx7f.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--L24yIETv--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/2tzdu5myadd95do8rx7f.png" alt="Alt Text"&gt;&lt;/a&gt; &lt;br&gt;
Yes, the balance is there, and you can see the logs and &lt;code&gt;Chaos Results&lt;/code&gt; below it.&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--8zLFnUy9--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/s61d5wavipvj62frn9on.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--8zLFnUy9--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/s61d5wavipvj62frn9on.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;You can see logs and Chaos Results below it.&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--hzJmBYpH--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/an0xbizqo50zm6r2z9ce.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--hzJmBYpH--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/an0xbizqo50zm6r2z9ce.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;We have briefly discussed the &lt;code&gt;Bank Of Anthos resilience&lt;/code&gt; predefined workflow where the &lt;code&gt;Bank Of Anthos&lt;/code&gt; application resiliency and its relationship with LitmusChaos has shown.&lt;/p&gt;

&lt;p&gt;The workflow has been discussed in the  Introduction Bank Of Anthos Resiliency Workflow. In LitmusChaos, we are continuously working and testing our experiments applications.&lt;br&gt;
Among the different predefined workflows and kubernetes workflows implemented, our 3rd predefined workflow is Bank Of Anthos-Resiliency-Check, which has been elaborated with scenario effects and its causes.&lt;/p&gt;

&lt;p&gt;Thank you for reading it till the end. I hope you had a productive time learning about LitmusChaos. Are you an SRE or a Kubernetes enthusiast? Does Chaos Engineering excite you? &lt;/p&gt;

&lt;p&gt;Join the LitmusChaos Community Slack channel by joining the &lt;code&gt;#litmus&lt;/code&gt; channel on the Kubernetes (&lt;a href="https://slack.k8s.io/"&gt;https://slack.k8s.io/&lt;/a&gt;) Slack!&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;References and Links&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://kubernetes.slack.com/archives/CNXNB0ZTN"&gt;Slack&lt;/a&gt;&lt;br&gt;
&lt;a href="https://litmuschaos.io/"&gt;LitmusChaos&lt;/a&gt;&lt;br&gt;
&lt;a href="https://hub.litmuschaos.io/"&gt;Litmus ChaosHub&lt;/a&gt;&lt;br&gt;
&lt;a href="https://github.com/litmuschaos/litmus"&gt;Github Repo Litmus&lt;/a&gt;&lt;br&gt;
&lt;a href="https://kubernetes.slack.com/?redir=%2Farchives%2FCNXNB0ZTN"&gt;Connect with us on Slack&lt;/a&gt;&lt;br&gt;
&lt;a href="https://github.com/litmuschaos/chaos-charts/tree/master/charts/generic"&gt;chaos-charts&lt;/a&gt;&lt;br&gt;
&lt;a href="https://www.youtube.com/channel/UCa57PMqmz_j0wnteRa9nCaw"&gt;Litmus Chaos YouTube Channel&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Submit a pull request if you identify any necessary changes.&lt;br&gt;
Do not forget to share these resources with someone you think might need help to learn/explore more about Chaos Engineering.&lt;/p&gt;

</description>
      <category>litmuschaos</category>
      <category>kubernetes</category>
      <category>googlecloud</category>
      <category>application</category>
    </item>
    <item>
      <title>Litmus - Soaring Heights</title>
      <dc:creator>OUM NIVRATHI KALE</dc:creator>
      <pubDate>Tue, 25 Aug 2020 12:18:43 +0000</pubDate>
      <link>https://dev.to/oumkale/litmus-soaring-height-nbd</link>
      <guid>https://dev.to/oumkale/litmus-soaring-height-nbd</guid>
      <description>&lt;h1&gt;
  
  
  &lt;strong&gt;About LitmusChaos&lt;/strong&gt;
&lt;/h1&gt;

&lt;p&gt;&lt;br&gt;
&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fraw.githubusercontent.com%2Flitmuschaos%2Flitmus%2Fmaster%2Fimages%2Flitmus-logo-white-bg-icon.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fraw.githubusercontent.com%2Flitmuschaos%2Flitmus%2Fmaster%2Fimages%2Flitmus-logo-white-bg-icon.png" alt="Alt text of image"&gt;&lt;/a&gt;&lt;br&gt;
LitmusChaos provides a complete set of tools required by Kubernetes developers and SREs to carry out chaos tests easily and in Kubernetes-native way. LitmusChaos is a chaos engineering framework for Kubernetes.&lt;br&gt;
The project has “Declarative Chaos” as the fundamental design goal and keeps the community at the center for growing the chaos experiments.&lt;br&gt;
 &lt;/p&gt;
&lt;h3&gt;
  
  
  &lt;strong&gt;Litmus broadly contains&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;1.Chaos Operator&lt;br&gt;
2.Chaos CRDs&lt;br&gt;
3.Chaos experiments or the ChaosHub&lt;br&gt;
4.Chaos Scheduler&lt;br&gt;
5.Chaos metric exporter&lt;br&gt;
6.Chaos events exporter&lt;br&gt;
7.Portal&lt;br&gt;
 &lt;/p&gt;
&lt;h3&gt;
  
  
  &lt;strong&gt;In this blog, we’ll mainly talk about Litmus analytics.&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;Now, let's have a broad discussion about Analytics.&lt;/strong&gt;&lt;br&gt;
 &lt;br&gt;
1.Analytics of Experiments and our Growth&lt;br&gt;
2.Most popular places where Litmus users are located&lt;br&gt;
3.Structure of maps and their dependencies&lt;br&gt;
4.Loading Data and rending basic maps from libraries in React App&lt;br&gt;
5.References and Links&lt;br&gt;
 &lt;/p&gt;
&lt;h3&gt;
  
  
  &lt;strong&gt;Analytics about users&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;We are happy to share that our community has been reaching great heights these days, and we are happy to have achieved this milestone, and we are grateful to our users for supporting us always. Recently we have been getting a great response from the users and have a lot of active users. We are trying to expand our resources and our work worldwide.&lt;br&gt;
 &lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Ffb2dlts4snywdczuhoe1.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Ffb2dlts4snywdczuhoe1.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;br&gt;
Note: The above analytics data was noted on 25th Aug 2020.&lt;/p&gt;

&lt;p&gt;In the current situation, we are experiencing Operator installed 14k+, Total Experiment Runs 108k+, Total Experiments 35 and Github star 1k+, and counting.&lt;br&gt;
 &lt;/p&gt;
&lt;h4&gt;
  
  
  &lt;strong&gt;Litmus Growth&lt;/strong&gt;
&lt;/h4&gt;

&lt;p&gt;The below graph is showing the growth of our Litmus community based on Operator Experiment analytics.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2F899tpn2gqjw3yzt55fkx.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2F899tpn2gqjw3yzt55fkx.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;br&gt;
&lt;/p&gt;

&lt;h4&gt;
  
  
  &lt;strong&gt;Experiments&lt;/strong&gt;
&lt;/h4&gt;

&lt;p&gt;&lt;strong&gt;Generic&lt;/strong&gt;: Pod Delete, Container Kill, Pod Network Latency, Pod Network Loss, Pod Network Corruption, Pod CPU Hog, Pod Memory Hog, Disk Fill, Disk Loss, Node CPU Hog, Node Memory Hog, Node Drain, Kubelet Service Kill, Pod Network Duplication, Node Taint, Docker Service Kill, Pod Autoscaler.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Kubernetes&lt;/strong&gt;: Kubernetes Application Pod, Kubernetes Application Service, Kubernetes Cluster Level Pod - kiam, EC2 Terminate.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;OpenEBS&lt;/strong&gt;: Target Container Failure, Target Network Latency, Target Network Loss, Target Pod Failure, Pool Pod Failure, Pool Container Failure, Pool Network Latency, Pool Network Loss, Control Plane Chaos, cStor Pool Chaos, Pool Disk Loss, NFS Provisioner Kill.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Kafka&lt;/strong&gt;: Broker Pod Failure, Broker Disk Failure, CoreDns CoreDNS Pod Delete, Cassandra Cassandra Pod Delete.&lt;br&gt;
 &lt;/p&gt;
&lt;h3&gt;
  
  
  &lt;strong&gt;Most popular places where Litmus users are located&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;We have now crossed 170+ Cities and 35+ Countries worldwide where Litmus users are located. Currently, the top 10 countries are India, USA, China, Netherlands, France, Ukraine, Germany, Japan, Ireland, and Taiwan.&lt;br&gt;
 &lt;/p&gt;
&lt;h4&gt;
  
  
  &lt;strong&gt;City Wise Users&lt;/strong&gt;
&lt;/h4&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fqcgdzgvynaslofxb3xcc.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fqcgdzgvynaslofxb3xcc.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;br&gt;
 &lt;/p&gt;

&lt;p&gt;Here the worldwide stats including the users from particular cities in the Map are shown.&lt;br&gt;
 &lt;/p&gt;
&lt;h4&gt;
  
  
  &lt;strong&gt;Country Wise Users&lt;/strong&gt;
&lt;/h4&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fe7cr6j1t0cd27anpkvtb.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fe7cr6j1t0cd27anpkvtb.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;br&gt;
Here you can see our worldwide stats, including the users from particular countries in the Maps.&lt;br&gt;
 &lt;/p&gt;
&lt;h3&gt;
  
  
  &lt;strong&gt;Structure of maps and their dependencies&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;To create a Geo map, one needs to have basic React knowledge. We have used React and TypeScript for development.&lt;br&gt;
For the map, I used &lt;code&gt;react-simple-maps&lt;/code&gt; for city-wise plotting and &lt;code&gt;react-google-charts&lt;/code&gt; for country wise plotting.&lt;br&gt;
 &lt;br&gt;
My approach was to plot data on Geo map using city wise, so it is good to show dots on the map to have proper visualization.&lt;br&gt;
 &lt;br&gt;
Loading Data and rending basic maps from libraries in React App and Code&lt;/p&gt;

&lt;p&gt;The code structure is :&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;┬ Litmus-Portal  
├─┬ backend
| └ frontend
|    ├─┬ src
|      └── components
|        ├─┬ GeoMap
│          ├── CityMap.tsx
|          ├── CountryMao.tsx
|          ├── index.ts 
│          └── geo.json
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;h4&gt;
  
  
  &lt;strong&gt;CityMap&lt;/strong&gt;
&lt;/h4&gt;

&lt;p&gt;The CityMap component will render a map based on the city-wise count of Chaos Experiments. Since I want to customize the projection for markers, so I take advantage of Marker property.&lt;br&gt;
 &lt;br&gt;
Start by defining an interface for the name, and coordinates &amp;amp; data will be loaded asynchronously once the component mounts (useEffect()). Also, it will fetch geo.json to map the coordinates.&lt;br&gt;
For the projection marker, I am keeping the same color for all with circle opacity.&lt;br&gt;
 &lt;br&gt;
Required libraries are given below, and geoURL are coordinates of the World Map for mapping purposes.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import React, { useEffect, useState } from 'react';
import { useSelector } from 'react-redux';
import {
  ComposableMap,
  Geographies,
  Geography,
  Marker,
  ZoomableGroup,
} from 'react-simple-maps';
import { RootState } from '../../redux/reducers';
import datageo from './geo.json';
const geoUrl = datageo;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;React components have a built-in state object, which stores the properties that belong to the Map component. When the state object changes, the component re-renders.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const [mapData, setMapData] = useState&amp;lt;CityData[]&amp;gt;([]);

  const geoCity = useSelector(
    (state: RootState) =&amp;gt; state.communityData.google.geoCity
  );

  useEffect(() =&amp;gt; {
    const cityData: CityData[] = [];
    geoCity.map((e) =&amp;gt;
      cityData.push({
        name: e.name,
        coordinates: [parseFloat(e.longitude), parseFloat(e.latitude)],
      })
    );
    setMapData(cityData);
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Adding a Map with marker&lt;/strong&gt;&lt;br&gt;
To show data on each city map, I have added markers event listeners along with Composable Map and Zoomable Group.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;     &amp;lt;ComposableMap style={{width: 640, height: 340,}}&amp;gt;
        &amp;lt;ZoomableGroup zoom={1.3}&amp;gt;
          &amp;lt;Geographies geography={geoUrl}&amp;gt;
            {({ geographies }) =&amp;gt;
              geographies.map((geo) =&amp;gt; (
                &amp;lt;Geography
                  key={geo.rsmKey}
                  geography={geo}
                  fill="#CFCFCF"
                  stroke="#CFCFCF"
                /&amp;gt;
              ))
            }
          &amp;lt;/Geographies&amp;gt;
          {mapData &amp;amp;&amp;amp;
            mapData.map(({ name, coordinates }) =&amp;gt; (
              &amp;lt;Marker key={`${name}_${coordinates}`} coordinates={coordinates}&amp;gt;
                &amp;lt;g
                  stroke="#858CDD"
                  strokeWidth="2"
                  strokeLinecap="round"
                  strokeLinejoin="round"
                  transform="translate(-12, -24)"
                &amp;gt;
                  &amp;lt;circle cx="12" cy="10" r="4" /&amp;gt;
                &amp;lt;/g&amp;gt;
              &amp;lt;/Marker&amp;gt;
            ))}
        &amp;lt;/ZoomableGroup&amp;gt;
      &amp;lt;/ComposableMap&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  &lt;strong&gt;CountryMap&lt;/strong&gt;
&lt;/h4&gt;

&lt;p&gt;The CountryMap component will render a map based on the country-wise count of Experiments.&lt;br&gt;
The approach is the same as CityMaps only difference is rendering a data country-wise and added hovering effects.&lt;br&gt;
 &lt;br&gt;
Originally data is stored in states in 2D Array with Columns Country and Users so I have taken the CountryMap variable, which stores the properties that belong to the Map component. When the state object changes, the component re-renders.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const CountryMap = () =&amp;gt; {
  const data: string[][] = useSelector(
    (state: RootState) =&amp;gt; state.communityData.google.geoCountry
  );
  const parsedData = data.map((item) =&amp;gt; [item[0], parseInt(item[1], 10)]);
  parsedData.unshift(['Country', 'Count'])
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Showing Gradient&lt;/strong&gt;&lt;br&gt;
To give users an idea about the intensity of data, we can show a linear gradient with min = minimum of all values and max = maximum of all values.&lt;br&gt;
 &lt;br&gt;
To show data on the hover of each country, we can add onMouseEnter and onMouseLeave event listeners, which shows the Country and Users from those countries.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;   &amp;lt;Chart
        style={{ margin: 'auto' }}
        width="640px"
        height="340px"
        chartType="GeoChart"
        data={parsedData}
        options={{
          colorAxis: { colors: ['#2CCA8F', 'gray', '#5B44BA'] 
        },
          backgroundColor: '#ffffff',
          datalessRegionColor: '#CFCFCF',
          defaultColor: '#CFCFCF',
        }}
        rootProps={{ 'data-testid': '1' }}
      /&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  &lt;strong&gt;We are looking forward to the users contributing to our Litmus Community.&lt;/strong&gt;
&lt;/h2&gt;



&lt;h3&gt;
  
  
  &lt;strong&gt;References and Links&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://litmuschaos.io/" rel="noopener noreferrer"&gt;LitmusChaos&lt;/a&gt;&lt;br&gt;
&lt;a href="https://hub.litmuschaos.io/" rel="noopener noreferrer"&gt;Litmus ChaosHub&lt;/a&gt;&lt;br&gt;
&lt;a href="https://github.com/litmuschaos/litmus" rel="noopener noreferrer"&gt;Github Repo Litmus&lt;/a&gt;&lt;br&gt;
&lt;a href="https://kubernetes.slack.com/?redir=%2Farchives%2FCNXNB0ZTN" rel="noopener noreferrer"&gt;Connect with us on Slack&lt;/a&gt;&lt;br&gt;
&lt;a href="https://www.youtube.com/channel/UCa57PMqmz_j0wnteRa9nCaw" rel="noopener noreferrer"&gt;Litmus Chaos YouTube Channel&lt;/a&gt;&lt;br&gt;
 &lt;br&gt;
We are happy that we are contributing to the growth of our users and helping them rise and shine along with us.&lt;br&gt;
&lt;br&gt;
&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Ft8n0251e5ipntdmcuulh.jpeg" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Ft8n0251e5ipntdmcuulh.jpeg" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

</description>
      <category>litmuschaos</category>
      <category>kubernetes</category>
      <category>analytics</category>
      <category>devops</category>
    </item>
  </channel>
</rss>
