Setting up Chaos Toolkit in Kubernetes
In this lesson, we set up Chaos Toolkit in Kubernetes by defining configurations using ConfigMap and creating a ServiceAccount.
Defining configuration in Kubernetes using the ConfigMap
Before we start running chaos experiments inside the Kubernetes cluster, we’ll need to set up at least two things:
- We’ll need experiment definitions stored somewhere in the cluster. The most common and the most logical way to define a configuration in Kubernetes is to use ConfigMap.
- Apart from having experiment definitions readily available, we will also need to create a ServiceAccount that will provide the necessary privileges to processes that will run the experiments.
Inspecting the definition of ConfigMap
Let’s start with the ConfigMap.
Press + to interact
cat k8s/chaos/experiments.yaml
The output, limited to the first experiment, is as follows.
...
apiVersion: v1
kind: ConfigMap
metadata:
name: chaostoolkit-experiments
data:
health-http.yaml: |
version: 1.0.0
title: What happens if we terminate an instance of the application?
description: If an instance of the application is terminated, the applications as a whole should still be operational.
tags:
- k8s
- pod
steady-state-hypothesis:
title: The app is
...Access this course and 1400+ top-rated courses and projects.