# Harness: The Key to Efficiently Running Chaos Experiments

I recently happened to attend the [Chaos Carnival](https://chaoscarnival.io/) where I learned about some amazing tools and it was my second year attending it. Chaos Engineering has gained so much value today that is not just a checklist item for the stability of your systems but also a mechanism by which you are ensuring that the steady state hypothesis of your systems is well known to you and how to better them.

[Harness](https://www.harness.io/products/chaos-engineering) as a tool has a lot to offer, but in this article, I'll be trying out only the chaos engineering features that it provides.

* To get started, the first step would be to sign up on Harness. You will be getting enterprise trial version for 15 days.
    
    ![](https://cdn.hashnode.com/res/hashnode/image/upload/v1679677727636/5c79a8d5-d0ca-4051-a6d0-91eb8fedacd0.png align="center")
    
* Create a project
    
    ![](https://cdn.hashnode.com/res/hashnode/image/upload/v1679677881478/2a4c35fe-7074-4909-9a71-56d19a3089c1.png align="center")
    
* Setup your environment
    
    ![](https://cdn.hashnode.com/res/hashnode/image/upload/v1679677919851/9192db6c-8aa8-4b99-8f33-83333c87503a.png align="center")
    
* Enable Chaos
    
    ![](https://cdn.hashnode.com/res/hashnode/image/upload/v1679806755932/93526f6f-6354-4b89-881d-a795a87ddae9.png align="center")
    
* I'll be setting up a Kubernetes cluster, thanks to [KodeKloud](https://kodekloud.com/pages/playgrounds), I get to easily spin up a k3s cluster.
    
    * Configure chaos infrastructure
        
        ![](https://cdn.hashnode.com/res/hashnode/image/upload/v1679678038625/827e522f-1ba4-468b-a7dd-424ee9b4f5bb.png align="center")
        
        * Deploy chaos infrastructure on your k8s cluster using the reference yaml after you click download.
            
            ![](https://cdn.hashnode.com/res/hashnode/image/upload/v1679804890336/f55e7956-7eff-472d-af3f-4166072a12c0.png align="center")
            
        * After a successful connection, you should see the heartbeat and status 'CONNECTED'
            
            ![](https://cdn.hashnode.com/res/hashnode/image/upload/v1679807151555/35f49662-d86e-48d0-9beb-d413dfb1ccdb.png align="center")
            
            * Now, time to create some chaos experiments.
                
                ![](https://cdn.hashnode.com/res/hashnode/image/upload/v1679807277295/6fe99b77-ee24-4aa5-b10b-5d245e94ecf3.png align="center")
                
                * You can either pick from the available template (LitmusChaos) or make your yaml template. In this case, I'll be using the Kubernetes node CPU hog template.
                    
                    ![](https://cdn.hashnode.com/res/hashnode/image/upload/v1679807426230/5a7d08ef-e45d-4d78-b2cb-673c343cfc31.png align="center")
                    
                    ![](https://cdn.hashnode.com/res/hashnode/image/upload/v1679807812342/d3ccb65e-1d76-49f5-a086-4d311255aad0.png align="center")
                    
* Run the attack
    
    ![](https://cdn.hashnode.com/res/hashnode/image/upload/v1679808077152/d1c4688f-acaa-45ab-ba4f-8751f67eb2c3.png align="center")
    
* Check the execution status and logs
    
    ![](https://cdn.hashnode.com/res/hashnode/image/upload/v1679808305091/06de8b46-22ef-4d58-907f-26dc07b9f890.png align="center")
    
* During the attack, try checking the CPU spike,
    
    ![](https://cdn.hashnode.com/res/hashnode/image/upload/v1679808814756/9ade1b6c-0e97-4b5e-8d45-a37d1a79a4b9.png align="center")
    
* At the end of the experiment, you can check the resiliency score.
    
    ![](https://cdn.hashnode.com/res/hashnode/image/upload/v1679808492515/6b47d676-4e73-4e34-bd77-50bceb1f5f75.png align="center")
    
* Re-run the experiment with additional steps. In the below example, I've added timechaos and kubelet service kill.
    
    ![](https://cdn.hashnode.com/res/hashnode/image/upload/v1679810047873/5238cbd6-2847-4edc-95d4-1d328c80c958.png align="center")
    
    since the experiment did not succeed fully, the resilience score was updated accordingly to 33.33% because only 1/3 stages passed. The last 2 stages failed because I didn't configure them to run on the required pods/nodes.
    
* If you re-run the same experiment after reconfiguration and the attack execution completes successfully, you'll see an improved resilience score.
    
    ![](https://cdn.hashnode.com/res/hashnode/image/upload/v1679811763319/f41d2020-be75-4d2d-a3d5-f416229d075e.png align="center")
    
    I look to explore further more on the probes and combinations of different attacks.
    
      
      
    If you happen to use harness for your chaos engineering attacks, do share about them in the comments!
