Skip to content

Commit af077b6

Browse files
committed
formatting per AsciiDoc style, fixed aws-samples#426
1 parent a4780c4 commit af077b6

File tree

1 file changed

+30
-16
lines changed
  • 03-path-application-development/310-chaos-engineering

1 file changed

+30
-16
lines changed

03-path-application-development/310-chaos-engineering/readme.adoc

Lines changed: 30 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,10 @@ An empirical process, Chaos Engineering experiments exercise a distributed syste
2626

2727
The link:http://principlesofchaos.org/["Principles of Chaos"] define the practical process that Chaos Engineering executes as:
2828

29-
1. Start by defining ‘steady state’ as some measurable output of a system that indicates normal behavior.
30-
2. Hypothesize that this steady state will continue in both the control group and the experimental group.
31-
3. Introduce variables that reflect real world events like servers that crash, hard drives that malfunction, network connections that are severed, etc.
32-
4. Try to disprove the hypothesis by looking for a difference in steady state between the control group and the experimental group.
29+
. Start by defining ‘steady state’ as some measurable output of a system that indicates normal behavior.
30+
. Hypothesize that this steady state will continue in both the control group and the experimental group.
31+
. Introduce variables that reflect real world events like servers that crash, hard drives that malfunction, network connections that are severed, etc.
32+
. Try to disprove the hypothesis by looking for a difference in steady state between the control group and the experimental group.
3333

3434
In this chapter we will explore implementing this process using the free and open source link:http://chaostoolkit.org/[Chaos Toolkit].
3535

@@ -58,7 +58,17 @@ Wait for approximately 3 mins for the load balancer to accept request.
5858

5959
A link:http://chaostoolkit.org/[Chaos Toolkit] experiment is defined using a link:http://chaostoolkit.org/reference/api/experiment/[JSON file format].
6060

61-
In addition the experiment also begins with some header information that describes the experiment being conducted:
61+
Each experiment consists of:
62+
63+
. Header
64+
. Steady-state
65+
. Method & Probes
66+
67+
Let's look at how each of these are defined next.
68+
69+
=== Header
70+
71+
The experiment begins with some header information that describes the experiment being conducted:
6272

6373
[source, JSON]
6474
----
@@ -80,7 +90,7 @@ In addition the experiment also begins with some header information that describ
8090

8191
The `version` describes the version of the experiment definition being followed. `title` and `description` describe the experimental hypothesis being explored.
8292

83-
It is typical to build up a catalogue of experiments when exploring the weaknesses in a system, and so `tags` are used to provide searchable labels to make that catalogue more easily navigable.
93+
It is typical to build up a catalog of experiments when exploring the weaknesses in a system, and so `tags` are used to provide searchable labels to make that catalogue more easily navigable.
8494

8595
Finally `configuration` is used to supply configuration parameters to the experiment, in this case populating the `web_app_url` configuration parameter with the contents of the `WEBAPP_URL` environment variable.
8696

@@ -90,9 +100,11 @@ Steady-State defines how a system should observably respond, often within a tole
90100

91101
For the sample application, steady-state could be defined as:
92102

93-
"The root URL of the `webapp` microservice should always respond with a `200 OK` link:https://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html[HTTP Status Code] within a timeout of 3 seconds."
103+
***********
104+
The root URL of the `webapp` microservice should always respond with a `200 OK` link:https://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html[HTTP Status Code] within a timeout of 3 seconds.
105+
***********
94106

95-
Using the link:http://chaostoolkit.org/[Chaos Toolkit's] JSON experiment definition format, this steady-state can be defined as:
107+
Using the http://chaostoolkit.org/reference/api/experiment/#steady-state-hypothesis[Chaos Toolkit's JSON experiment definition format], steady-state hypothesis can be defined as:
96108

97109
[source, JSON]
98110
----
@@ -132,13 +144,11 @@ Steady-state begins with a `title`, which describes what the steady-state repres
132144

133145
In this case the probes detect that all the pods are in the `running` phase, and that the URL, supplied by the `web_app_url` configuration parameter, returns the specified status code, `200`, within the specified timeout, `3` seconds.
134146

135-
=== Defining the Experimental Method
147+
=== Method & Probes
136148

137-
Step 3 of the chaos engineering process is:
149+
The last step of the Chaos Engineering process is to introduce variables that reflect real world events like servers that crash, hard drives that malfunction, network connections that are severed, etc.
138150

139-
3. Introduce variables that reflect real world events like servers that crash, hard drives that malfunction, network connections that are severed, etc.
140-
141-
These _variables_ are introduced through the link:http://chaostoolkit.org/[Chaos Toolkit's] experimental `method`:
151+
These _variables_ are introduced using `method`:
142152

143153
[source, JSON]
144154
----
@@ -173,10 +183,14 @@ These _variables_ are introduced through the link:http://chaostoolkit.org/[Chaos
173183
],
174184
----
175185

176-
This experiment's method first has an `action` that kills all pods that have the label of `app=greeter-pod`. Often link:http://chaostoolkit.org/[Chaos Toolkit] experimental methods only contain actions, as it is the actions that manipulate the real-world variables of the distributed system.
186+
This experiment's method first has an `action` that kills all pods that have the label of `app=greeter-pod`. Often Chaos Toolkit experimental methods only contain actions, as it is the actions that manipulate the real-world variables of the distributed system.
177187

178188
In this experiment's case there is _also_ a `probe` in the method. Probes in an experiment's method give us a chance to collate more information as the real-world variables are being manipulated by the experiment. The `probe` here extends the output of the experiment with the logs from pods labelled with `app==webapp-pod`.
179189

190+
Install the Kubernetes extension for Chaos Toolkit:
191+
192+
pip install chaostoolkit-kubernetes
193+
180194
=== Rollbacks
181195

182196
It is sometimes useful to supply an additional set of actions at the end of an experiment so that any actions in the method that were undertaken can be explicitly reversed. These are contained in a `rollback` section, but as Kubernetes will recover from this experiment's actions anyway there are no rollback actions required in this case:
@@ -193,9 +207,9 @@ This completes the experiment definition.
193207

194208
With your cluster running you will first need to ensure you populate the `WEBAPP_URL` environment variable with the URL of your cluster's `webapp-service` endpoint.
195209

196-
$ export WEBAPP_URL="http://$(kubectl get svc/webapp-service -o jsonpath={.status.loadBalancer.ingress[0].ip})/"
210+
$ export WEBAPP_URL="http://$(kubectl get svc/webapp-service -o jsonpath={.status.loadBalancer.ingress[0].hostname})/"
197211

198-
Now you can run the link:./experiments/experiment.json[experiment] using the link:http://chaostoolkit.org/[Chaos Toolkit's] `chaos run` command:
212+
Now you can run the link:./experiments/experiment.json[experiment] using the `chaos run` command:
199213

200214
$ chaos run experiment.json
201215
[2018-03-10 14:42:38 INFO] Validating the experiment's syntax

0 commit comments

Comments
 (0)