Difficulty: beginner
Estimated Time: 5 minutes

While you can write your experiments from scratch, it is the mission of the Chaos Toolkit to make it as easy and quick as possible to create your own experiments and so the toolkit also comes with the chaos discover and chaos init commands.

Rather than starting from a blank slate, the chaos discover and chaos init commands can help you to explore your current target environment to see what can be acted or probed upon, and then to generate great starting points for your own chaos engineering experiments.

You have now seen how to use the chaos discover and chaos init commands to explore what you might like to do with the probes and actions on your target environment and used that information to simply and easily create a chaos engineering experiment.

By using chaos discover and chaos init you can now create a catalogue of experiments to explore all your system's weaknesses and build confidence in those weaknesses being addressed by running your new automated chaos experiments continuously.

Discover and Initialise Your Experiments

Step 1 of 2

Introducing the 'chaos discover' command

The Chaos Toolkit CLI, called chaos, comes with the discover command that can be used to explore what can be acted or probed upon in a given environment from within your own chaos experiments.

In our case here we already have a kubernetes environment and so we can use the chaos discover command to give us a report of what's available.

To use the chaos command you need to turn on the Python virtual environment that the command is installed into:

source ~/.venvs/chaostk/bin/activate

With the chaostk virtual environment activated, you should now be able to execute the chaos discover command. The chaos discover command requires a minimum of one parameter, which is usually the extension it is to use to explore your particular environment. In this environment you have Kubernetes and so you can run the following command to discover what can be acted upon or probed within your kubernetes environment:

chaos discover chaostoolkit-kubernetes

You can specify other environments than Kubernetes for chaos toolkit to discover. For example, to discover what's available from your Cloud Foundry environment you would use chaos discover chaostoolkit-cloudfoundry.

NOTE: The chaos discover chaostoolkit-kubernetes command uses the default configuration that has been configured for your local kubectl command.

When you execute chaos discover chaostoolkit-kubernetes you should see an output such as the following:

[2018-01-16 16:59:56 INFO] Attempting to download and install package 'chaostoolkit-kubernetes'
[2018-01-16 16:59:58 INFO] Package downloaded and installed in current environment
[2018-01-16 16:59:58 INFO] Discovering capabilities from chaostoolkit-kubernetes
[2018-01-16 16:59:58 INFO] Searching for actions
[2018-01-16 16:59:58 INFO] Searching for probes
[2018-01-16 16:59:58 INFO] Discovering Kubernetes system
[2018-01-16 16:59:58 INFO] Discovery report saved in ./discovery.json

Note the Discovery report saved in ./discovery.json message. Depending on the target environment the chaos discover command can result in a large amount of information about what can be done or probed in your chaos experiments. In the next tutorial you will see how you can use chaos discover in combination with chaos init to build your own Chaos Toolkit experiments quickly.

With the output of the chaos discover command to hand, you can now take what's been discovered and use that to create a new chaos experiment simply and easily...