chaosblade-action
is a GitHub action that applies chaos engineering to your development workflow using CHAOSBLADE. This action privides a way to perform different chaos experiment on the Kubernetes environment.
For more details on CHAOSBLADE, refer to https://chaosblade.io/.
- Kubernetes 1.16 or later.
- Helm 3.*
Prepare the configuration file (YAML) of the failures which you expect to inject into the system, for example container-cpu-fullload.yaml
:
apiVersion: chaosblade.io/v1alpha1
kind: ChaosBlade
metadata:
name: increase-container-cpu-load-by-id
spec:
experiments:
- scope: container
target: cpu
action: fullload
desc: "increase container cpu load by id"
matchers:
- name: container-names
value:
- "nginx"
- name: cpu-percent
value: ["100"]
# pod names
- name: names
value: ["nginx-0"]
- name: cgroup-root
value: ["/host-sys/fs/cgroup"]
Obtain the base64 value of the chaos configuration file using the following command:
CBCFY_BASE64=`base64 container-cpu-fullload.yaml`
- Deploy the Kubernetes cluster
A Kubernetes cluster is required for the workflow. You can use the following action to deploy :
- Deploy Application
The application needs to be deployed to perform the chaos injection. You can see the example:nginx-statefulset
- Use
chaosblade-action
.
To create the workflow in GitHub action, use chaosblade-io/chaosblade-action
in the yaml configuration file and configure the base64 value of the chaos configuration file, and set the version of CHAOSBLADE.
- name: Run chaosblade experiment
uses: chaosblade-io/chaosblade-action@master
env:
CBCFY_BASE64: ${CBCFY_BASE64}
CHAOSBLADE_VERSION: v1.7.1
If the chaos configuration file is committed to GitHub, you can set CBCFY_FILE
as the path to the file:
- name: Run chaosblade experiment
uses: chaosblade-io/chaosblade-action@master
env:
CBCFY_FILE: https://raw.githubusercontent.com/chaosblade-io/chaosblade-action/main/experiments/container-cpu-fullload/container-cpu-fullload.yaml
CHAOSBLADE_VERSION: v1.7.1
Variables | Description | Default Value |
---|---|---|
CBCFY_BASE64 | Configure the base64 value of the chaos configuration file. Just set one of CBCFY_BASE64 and CBCFY_FILE | NULL |
CBCFY_FILE | The path of the chaos configuration file. Just set one of CBCFY_BASE64 and CBCFY_FILE | NULL |
CHAOSBLADE_VERSION | The version of CHAOSBLADE | LATEST |
For the complete configuration file, see sample.