Developer Guide

Build a custom Krkn scenario, package its image contract, and run it through Krkn Operator.

Develop a scenario once, then expose it through a container image that Krkn’s clients can discover and configure. This guide follows the full path from a Python plugin to an execution managed by Krkn Operator.

The example is deliberately small: wait for a configurable number of seconds, list pods in a namespace through krkn-lib, and report success or failure. It lets you verify the integration without introducing a disruptive experiment.

Companion repository: krkn-chaos/krkn-dev-demo contains the plugin skeleton, container files, and Kind and registry configuration used throughout the lab.

Start with the hands-on lab

Build a custom scenario takes you through four stages:

  1. Implement the plugin. Complete the two abstract methods and bind a scenario type to a YAML configuration.
  2. Package and test the image. Add input metadata, render the configuration, and run the container with Podman.
  3. Run through the operator. Install a private registry and Krkn Operator in Kind, publish the image, and execute it against a registered target.
  4. Diagnose the integration. Recognize discovery, image pull, permission, kubeconfig, and plugin failures independently.

The lab builds a standalone scenario image from a custom Krkn base image. It does not require a krkn-hub checkout or a rebuild of krknctl or the operator. Target registration is supplied by the participant and is outside the lab.

Understand the contracts

Read Scenario architecture for the responsibilities of the registry, operator, node runtime, image startup script, Python plugin, and target cluster.

Validate and contribute

For upstream changes, follow the contribution guidelines and include the scenario’s documentation and relevant tests. Development questions are welcome in #krkn on Kubernetes Slack.


Scenario Architecture

Follow a scenario from registry metadata and typed inputs to execution against a target cluster.

Build a Custom Scenario

Build, package, publish, and run a small custom Krkn plugin with Podman, Kind, and Krkn Operator.

Scenario Plugin API

Naming, discovery, method signatures, and configuration binding for Krkn scenario plugins.

Scenario Image Contract

Define discoverable scenario images with OCI labels and krknctl input descriptors.

Using and Extending Krkn-lib

Reuse the cluster clients provided to scenario plugins and contribute shared Kubernetes and OpenShift helpers.

Testing Changes

Verify plugin behavior, the image contract, container startup, and operator execution as separate stages.

Adding Tests to Krkn

Add focused unit tests and functional coverage to the Krkn test suites.

Publishing Through Krkn-hub

Add a scenario to the community image collection after validating its standalone image contract.

Health Check Plugins

How to use and create health check plugins in Krkn to monitor services during chaos experiments