Skip to content

Commit 6859e75

Browse files
authored
docs(litmusctl): update create chaos experiment usage (closes #344) (#367)
* docs(litmusctl): update create chaos experiment usage (closes #344) Signed-off-by: vatsalm1611 <[email protected]> * docs(litmusctl): update create chaos experiment doc as per reviewer feedback (keep only steps 1–5) Signed-off-by: vatsalm1611 <[email protected]> --------- Signed-off-by: vatsalm1611 <[email protected]>
1 parent 30f77a1 commit 6859e75

File tree

1 file changed

+64
-2
lines changed

1 file changed

+64
-2
lines changed

website/docs/litmusctl/create-chaos-experiment.md

Lines changed: 64 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,69 @@ title: Create Chaos Experiment
44
sidebar_label: Create Chaos Experiment
55
---
66

7+
# Create a Chaos Experiment (litmusctl)
78

8-
This guide demonstrates how to create and run chaos experiments using litmusctl. You can create experiments using manifest files and manage them through the command line interface.
9+
This document explains how to create and manage Chaos Experiments using `litmusctl`.
910

10-
Follow this [guide](https://github.com/litmuschaos/litmusctl/blob/master/Usage_0.23.0.md#steps-to-create-a-chaos-experiment) to create Chaos Experiment.
11+
> **Prerequisite:** You should have a configured `litmusctl` account. See `litmusctl config set-account` to add an account.
12+
13+
## 1. Setup account (if not already done)
14+
15+
```shell
16+
# interactive (recommended)
17+
litmusctl config set-account
18+
19+
# non-interactive (example)
20+
litmusctl config set-account --endpoint="https://preview.litmuschaos.io" --username="admin" --password="PASSWORD"
21+
```
22+
23+
After running, verify using:
24+
25+
```shell
26+
litmusctl config view
27+
```
28+
29+
## 2. Get project and chaos-infra IDs
30+
31+
You will need `project-id` and `chaos-infra-id` to create an experiment.
32+
33+
```shell
34+
litmusctl get projects
35+
# Note the PROJECT ID you want to use.
36+
37+
litmusctl get chaos-infra --project-id "<project-id>"
38+
# Note the CHAOS INFRA ID from the output.
39+
```
40+
41+
## 3. Create a Chaos Experiment from a manifest
42+
43+
You can create a Chaos Experiment by passing a YAML manifest:
44+
45+
```shell
46+
litmusctl create chaos-experiment -f custom-chaos-experiment.yml --project-id "<project-id>" --chaos-infra-id "<chaos-infra-id>"
47+
```
48+
49+
If creation is successful, you will receive confirmation and the created experiment ID.
50+
51+
**Example:**
52+
```text
53+
🚀 Chaos Experiment/experiment-1 successfully created 🎉
54+
```
55+
56+
## 4. Save a Chaos Experiment (store manifest in Litmus)
57+
58+
If you want to save an experiment manifest in the project:
59+
60+
```shell
61+
litmusctl save chaos-experiment -f custom-litmus-experiment.yaml --project-id "<project-id>"
62+
```
63+
64+
## 5. Run a Chaos Experiment
65+
66+
You can run a previously created experiment by ID:
67+
68+
```shell
69+
litmusctl run chaos-experiment --project-id "<project-id>" --chaos-experiment-id "<experiment-id>"
70+
```
71+
72+
If the command prompts for values, provide the requested `project-id` and `experiment-id`.

0 commit comments

Comments
 (0)