Note
This repository contains all the material of my talk "How Chaos Engineering Works: Implementing Failure Injection on Kubernetes with Rust".
Note: kerris is a toy/demo implementation of a chaos controller!
kerris is a Kubernetes chaos controller written in Rust. It introduces failures into your cluster by watching custom resources and acting on them via two components:
- Controller — reconciles
PodChaosandNetworkChaoscustom resources - Daemon — a DaemonSet that runs on each node and executes low-level fault injection via containerd
Supported failure modes:
| CRD | Actions |
|---|---|
PodChaos |
pod-kill, container-kill |
NetworkChaos |
packet loss |
To be able to play around with kerris you will need:
If you want to try kerris out you can run setup.sh, which automates steps 1–6 below.
Or you can run these steps manually:
-
Create local Kubernetes cluster using kind:
kind create cluster
-
Build the container image for the controller and make it available in the cluster:
docker build -t kerris-controller:latest -f Dockerfile.controller . kind load docker-image kerris-controller:latest -
Build the container image for the daemon (or agent) and make it available in the cluster:
docker build -t kerris-daemon:latest -f Dockerfile.daemon . kind load docker-image kerris-daemon:latest -
Create
kerris-systemNamespace (required before applying manifests):kubectl create namespace kerris-system
-
Apply CustomResourceDefinitions:
cargo run --bin crdgen | kubectl apply -f - -
Install
kerris:kubectl apply -f manifests/
Warning
This setup works best with a single-node cluster.
This is useful during development to iterate quickly without rebuilding the container image.
Because the controller needs access to the daemon, you will need to port-forward the daemon locally:
kubectl --namespace kerris-system port-forward daemonsets/kerris-daemon 30666:30666Make sure the controller is not deployed by either stopping the kerris-controller Deployment:
kubectl --namespace kerris-system scale deployment kerris-controller --replicas 0or deleting it:
kubectl --namespace kerris-system delete deployments.apps kerris-controllerNow you can run the kerris-controller outside of the cluster using:
cargo run -- --daemon-addr http://localhost:30666