GitHub Action
Chaos Mesh
chaos-mesh-action
is a GitHub action that applies chaos engineering to your development workflow using Chaos Mesh. It automatically deploys the Chaos Mesh environment and injects the specified chaos experiment.
For more details on Chaos Mesh, refer to https://chaos-mesh.org/.
Prepare the configuration file (YAML) of the failures which you expect to inject into the system, for example:
apiVersion: chaos-mesh.org/v1alpha1
kind: NetworkChaos
metadata:
name: network-delay
namespace: busybox
spec:
action: delay # the specific chaos action to inject
mode: all
selector:
pods:
busybox:
- busybox-0
delay:
latency: "10ms"
duration: "5s"
scheduler:
cron: "@every 10s"
direction: to
target:
selector:
pods:
busybox:
- busybox-1
mode: all
Obtain the base64 value of the chaos configuration file using the following command:
CFG_BASE64=`base64 chaos.yaml`
- Deploy the Kubernetes cluster
A Kubernetes cluster is required for the workflow. You can use Kind Cluster or Kind Action to deploy.
- Use
chaos-mesh-action
.
To create the workflow in GitHub action, use chaos-mesh/chaos-mesh-action
in the yaml configuration file and configure the base64 value of the chaos configuration file, and set the version of Chaos Mesh. The chaos-mesh related configuration is as follows:
- name: Run chaos mesh action
uses: chaos-mesh/chaos-mesh-action@master
env:
CFG_BASE64: ${CFG_BASE64}
CHAOS_MESH_VERSION: v1.0.0
If the chaos configuration file is committed to GitHub, you can set CFG_FILE
as the path to the file:
- name: Run chaos mesh action
uses: chaos-mesh/chaos-mesh-action@master
env:
CFG_FILE: https://raw.githubusercontent.com/chaos-mesh/chaos-mesh-action/master/chaos-test.yaml
CHAOS_MESH_VERSION: v1.0.0
For the complete configuration file, see sample.
- Link to private K8s clusters is not supported for now.
- Only helm 3.x is supported for now.