chaos-monkey

by startxfr

Helm chartv21.3.418App 1.5.2GPL-3.0-or-laterVerified publisher

Helm chart used to deploy chaos monkey on Openshift or Kubernetes cluster. Chaos monkey are simple litle monkey released into your K8S cluster, they could be evil or kind according to your need. This chart is part of the startx chaos helm chart suite.

About this chart

Chaos Chart : ChaosMonkeys

This helm chart is used to deploy kube-monkey on an Openshift or Kubernetes cluster. Kube-monkey randomly terminates pods, during a daily time window, in the workloads that opted in with labels.

Upstream project : asobti/kube-monkey, deployed with the upstream helm chart kube-monkey version 1.5.2 ; image ayushsobti/kube-monkey:v0.5.2.

This chart is part of the chaos startx helm chart series focused on deploying various kind of chaos tools for cluster infrastructure or applications chaos-testing.

Requirements and guidelines

Read the startx helm-repository homepage for more information on how to use these resources.

Deploy this helm chart on openshift

1. Connect to your Openshift cluster

oc login -t <token> <cluster-url>

2. Install the repository

helm repo add startx https://helm-repository.readthedocs.io/en/latest/repos/stable/

3. Get information about this chart

helm show chart startx/chaos-monkey

4. Install this component

# Create the chaos-monkey namespace
helm install chaos-monkey-project startx/chaos-monkey --set project.enabled=true
# Deploy the monkey instance
helm install chaos-monkey-instance startx/chaos-monkey --set monkey.enabled=true -n chaos-monkey

Default values

The default values.yaml deploys nothing : each part is switched on by its enabled key.

  • project.enabled=true : 1 namespace chaos-monkey (see the project chart)
  • monkey.enabled=true : the kube-monkey deployment, its configuration and its service account, with 1 ClusterRole and 1 ClusterRoleBinding from the upstream chart (read the workloads and the namespaces, delete pods : nothing else)
  • monkey.privileged=true : 1 SecurityContextConstraints privileged-monkey with its Role and RoleBinding, for the kube-monkey service account

A workload is terminated only if it opted in (see the last usage example).

Migration from 21.3.390 and earlier (breaking changes) :

  • the ClusterRoleBinding kube-monkey-edit-rb, which gave the cluster role edit on the whole cluster to the kube-monkey and default service accounts of the namespace, is removed. Kube-monkey keeps the rights of the upstream ClusterRole. Anything else that relied on this binding (a workload running with the default service account of the namespace) needs its own RoleBinding.
  • the privileged SecurityContextConstraints privileged-monkey is no longer created by default : kube-monkey runs with the restricted one. Set monkey.privileged=true to get it back.
  • the log directory is now an emptyDir volume (monkey.additionalVolumes), writable by an arbitrary user.
KeyDefaultDescription
context.scopecompanynameName of the global scope for this application (organizational tenant)
context.clusterclusternameName of the cluster running this application (platform tenant)
context.environmentdevName of the environment for this application (ex: dev, factory, preprod or prod)
context.componentchaosComponent name of this application (logical tenant)
context.appkube-monkeyApplication name (functional tenant, default use Chart name)
context.version1.5.2Version name of this application (default use Chart appVersion)
project{...}Values of the project chart, which creates the namespace
project.enabledfalseCreate the namespace
project.project.namechaos-monkeyName of the namespace ; also the namespace of the resources created by this chart
monkey{...}Values of the upstream kube-monkey chart, passed as is
monkey.enabledfalseDeploy kube-monkey with the ClusterRole of the upstream chart
monkey.privilegedfalseGrant the privileged SecurityContextConstraints privileged-monkey to the kube-monkey service account
monkey.fullnameOverrideexample-monkeyName of the deployment and of its service account ; the SecurityContextConstraints follows it
monkey.config.dryRunfalsetrue logs the terminations without doing them
monkey.config.runHour8Hour of the day when the terminations of the day are scheduled
monkey.config.startHour / endHour10 / 16Time window of the terminations
monkey.config.timeZoneEurope/ParisTime zone of the three hours above
monkey.config.whitelistedNamespacesdefault, demo-, example-Namespaces where pods can be terminated
monkey.config.blacklistedNamespaceskube-system, openshift-*Namespaces never touched

Values files

helm install chaos-monkey-project startx/chaos-monkey -f https://raw.githubusercontent.com/startxfr/helm-repository/master/charts/chaos-monkey/values-startx-project.yaml
helm install chaos-monkey-instance startx/chaos-monkey -f https://raw.githubusercontent.com/startxfr/helm-repository/master/charts/chaos-monkey/values-startx-deploy.yaml -n startx-chaos-monkey

Usage examples

Default : namespace then kube-monkey

Two releases of the same chart, the namespace first.

helm install chaos-monkey-project startx/chaos-monkey --set project.enabled=true
helm install chaos-monkey-instance startx/chaos-monkey --set monkey.enabled=true -n chaos-monkey

Minimal : dry-run

Kube-monkey schedules and logs the terminations without doing them : use it to validate the schedule and the opt-in labels.

# my-monkey-dryrun-values.yaml
monkey:
  enabled: true
  config:
    dryRun: true
helm install chaos-monkey-instance startx/chaos-monkey -f my-monkey-dryrun-values.yaml -n chaos-monkey

Advanced : own schedule and an opted-in workload

Terminations on working days hours of another time zone, limited to two namespaces, then the labels a Deployment needs to become a target.

# my-monkey-values.yaml
context:
  scope: myorg
  cluster: mycluster
  environment: prod
  component: chaos
  app: kube-monkey
monkey:
  enabled: true
  config:
    dryRun: false
    runHour: 7
    startHour: 9
    endHour: 17
    timeZone: America/New_York
    whitelistedNamespaces: [ "myapp-dev", "myapp-test" ]
helm install chaos-monkey-instance startx/chaos-monkey -f my-monkey-values.yaml -n chaos-monkey
# opt a Deployment in : one pod killed, at most every 3 days (the labels go on the Deployment and on its pod template)
oc -n myapp-dev patch deployment myapp --type merge -p '{
  "metadata": {"labels": {"kube-monkey/enabled": "enabled", "kube-monkey/identifier": "myapp", "kube-monkey/mtbf": "3", "kube-monkey/kill-mode": "fixed", "kube-monkey/kill-value": "1"}},
  "spec": {"template": {"metadata": {"labels": {"kube-monkey/enabled": "enabled", "kube-monkey/identifier": "myapp"}}}}}'

Deploy with ArgoCD

One AppProject and two Applications : chaos-monkey-project (wave 1, the namespace) then chaos-monkey-instance (wave 5, kube-monkey in dry-run mode). The files are in examples/argocd.

git clone https://github.com/startxfr/helm-repository.git
cd helm-repository/charts/chaos-monkey
oc apply -k examples/argocd/

Each Application sets the enabled key of the other part to false, so that the two Applications never render the same resource. Delete chaos-monkey-instance first, wait for it to be gone, then delete chaos-monkey-project (it has no finalizer : a namespace can be slow to terminate).

History

ReleaseDateDescription
16.19.592024-12-09Align all chart to the 16.19.59 release
17.14.902025-04-30Publish stable release for 4.17 version
18.11.712025-11-27Align all charts to the same release
18.23.02026-02-28Start 4.19 branch
19.23.172026-03-02Align all dependencies to chart v19.23.11
20.14.152026-03-02Update all charts to OCP version 4.20.14
21.3.02026-03-02Update all chart to OCP version 4.21.3
21.3.2032026-06-24Improve chaos-monkey options
21.3.2782026-08-14add centigpu
21.3.3002026-10-21Add new charts and align all to this release
21.3.3092026-10-27Adding new charts perconna and align all to v21.3.309
21.3.3132026-11-04Add cluster-unifai and cluster-qdrant, align all charts to 21.3.313
21.3.3212026-11-05Adding external secret management
21.3.3712026-11-19Add Sail, oauthProxy, DSCInitialization, spot machines and annotations support
21.3.3772026-11-19full repository release: aligned pins, ArgoCD source fix, schemas and docs
21.3.3792026-11-19conventions wave: spelling, READMEs, ArgoCD examples and values-app, oauth switch
21.3.3892026-11-19full repository release: HTTPS dependency URLs, dependency-ordered release, schema guard, docs and examples
21.3.3902026-11-20full repository release: test fix, keepalived README, aligned pins
21.3.3912026-11-21chaos charts: krkn v5.2.15, new chaos-pipeline chart, security fixes for litmus and monkey; breaking, see README migration notes
21.3.3922026-11-21full repository release: chaos-pipeline run parameters and authenticated health check, aligned pins
21.3.3972026-11-21stable repository release 21.3.397: all charts aligned, unifai delegation cap documentation
21.3.3982026-11-21project: dockercfg existingSecret; chaos-pipeline: empty default for scenarios, optional ClusterOperator final check; chaos schemas regenerated
21.3.4102026-11-22full repository release: README conventions (Values files, Deploy with ArgoCD), conventions page
21.3.4122026-11-22full repository release: internal pins on the previous published version (ADR-0006)
21.3.4162026-11-23stable update: chart fixes (project, cluster-mongo, cluster-oadp, cluster-pipeline, cluster-machine, example-catalog); cluster-dvo accepts the grafana keys next to its historical keys, which keep priority
21.3.4182026-11-23commit a stable release of all charts

Deploy chaos-monkey with OpenTenant

Each tenant gets its own release of this chart, with its own namespace, secrets and domain. The builder below already has chaos-monkey on a Hetzner server. Change the host, add apps from the marketplace, then copy the generated files. Providers and prices are samples, and nothing here is sent anywhere.

  1. Pick a serverConnect Hetzner, OVHcloud or AWS. The builder starts on Hetzner, the cheapest sample rate.
  2. Place the chartchaos-monkey is pinned at v21.3.418 in opentenant.yaml. Drag more apps from the marketplace onto a rack.
  3. ApplySave opentenant.yaml and main.tf from the console, then run the commands below.
# opentenant.yaml, main.tf and dns.tf come from the builder below
opentenant validate opentenant.yaml
terraform init && terraform apply