Skip to content

ioboi/kerris

Repository files navigation

kerris

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!

Overview

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 PodChaos and NetworkChaos custom 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

Requirements

To be able to play around with kerris you will need:

Setup

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:

  1. Create local Kubernetes cluster using kind:

    kind create cluster
  2. 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
  3. 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
  4. Create kerris-system Namespace (required before applying manifests):

    kubectl create namespace kerris-system
  5. Apply CustomResourceDefinitions:

    cargo run --bin crdgen | kubectl apply -f -
  6. Install kerris:

    kubectl apply -f manifests/

Run controller outside of the cluster

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:30666

Make sure the controller is not deployed by either stopping the kerris-controller Deployment:

kubectl --namespace kerris-system scale deployment kerris-controller --replicas 0

or deleting it:

kubectl --namespace kerris-system delete deployments.apps kerris-controller

Now you can run the kerris-controller outside of the cluster using:

cargo run -- --daemon-addr http://localhost:30666

Contributors