chaos-kraken
by startxfr
Helm chart used to run krkn (kraken) chaos scenarios on Openshift or Kubernetes cluster. krkn is a chaos engine injecting failures in the cluster infrastructure and in applications. This chart is part of the startx chaos helm chart suite.
About this chart
Chaos Chart : Kraken
This helm chart runs krkn (formerly Kraken) chaos scenarios on an Openshift or Kubernetes cluster. krkn is a chaos engine injecting failures in the cluster infrastructure (pods of the platform, nodes, network, time) and in applications (pods, containers, network outage, storage), then checking that the platform recovers.
Upstream project: krkn-chaos/krkn, a CNCF sandbox project, version v5.2.15,
image quay.io/krkn-chaos/krkn (documentation).
| Period | Repository | Image |
|---|---|---|
| 2020-2022 | cloud-bulldozer/kraken | quay.io/openshift-scale/kraken |
| 2022 | chaos-kubox/krkn | quay.io/chaos-kubox/krkn |
| 2022-2024 | redhat-chaos/krkn | quay.io/redhat-chaos/krkn |
| 2024- | krkn-chaos/krkn | quay.io/krkn-chaos/krkn |
A chaos run is a one-shot Job. Two engines are available:
- core (default): one Job runs the krkn image with the scenarios enabled in
kraken.scenarios. Several scenarios per run, full krkn configuration, image pinned by tag and digest. - hub: one Job per scenario enabled in
kraken.hub.scenarios, each running a krkn-hub image configured by environment variables. krkn-hub tags are rolling (rebuilt every week).
To run the scenarios from Tekton pipelines, see the chaos-pipeline chart.
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.
Chaos scenarios destroy resources. Read each scenario before enabling it, start with pod scenarios, and never run node, network or time scenarios on a cluster you cannot afford to lose.
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-kraken
4. Install this component
# Install the kraken project
helm install --set project.enabled=true chaos-kraken-project startx/chaos-kraken
# Run one scenario: kill a prometheus pod of the cluster monitoring
helm install -n chaos-kraken chaos-kraken-run startx/chaos-kraken \
--set kraken.enabled=true --set kraken.scenarios.pods-monitoring.enabled=true
# Follow the run
oc logs -n chaos-kraken -f job/kraken-test
The Job is immutable: uninstall the release (helm uninstall chaos-kraken-run) before running another set of scenarios.
Default values
Nothing is deployed by default, and every scenario is disabled. With project.enabled=true and kraken.enabled=true
the chart creates:
- 1 project named chaos-kraken
- 1 serviceaccount named kraken, with a chaos clusterrole and its binding (local mode)
- 1 configmap with the krkn configuration and 1 configmap with the enabled scenarios
- 1 job named kraken-test, unprivileged, running the enabled scenarios against the cluster it runs in
Values files
- startx-project : values-startx-project.yaml creates the
startx-chaos-krakennamespace - startx-deploy : values-startx-deploy.yaml runs two pod scenarios (monitoring, ingress) with the core engine and the cerberus signal
- startx-deploy-hub : values-startx-deploy-hub.yaml runs the
pod-scenarioskrkn-hub image
helm install chaos-kraken-project startx/chaos-kraken -f https://raw.githubusercontent.com/startxfr/helm-repository/master/charts/chaos-kraken/values-startx-project.yaml
helm install chaos-kraken-deploy startx/chaos-kraken -f https://raw.githubusercontent.com/startxfr/helm-repository/master/charts/chaos-kraken/values-startx-deploy.yaml
Values dictionary
context values dictionary
| Key | Default | Description |
|---|---|---|
| context.scope | companyname | Name of the global scope for this application (organizational tenant) |
| context.cluster | clustername | Name of the cluster running this application (platform tenant) |
| context.environment | dev | Name of the environment for this application (ex: dev, factory, preprod or prod) |
| context.component | chaos | Component name of this application (logical tenant) |
| context.app | kraken | Application name (functional tenant, default use Chart name) |
| context.version | 5.2.15 | Version name of this application (default use Chart appVersion) |
chaos-kraken values dictionary
| Key | Default | Description |
|---|---|---|
| project | {...} | Configuration of the project (or namespace). Inherit from the project chart |
| project.enabled | false | Enable creation of the namespace |
| kraken.enabled | false | Unleash the kraken ;) |
| kraken.engine | core | Engine used to run the chaos: core or hub |
| kraken.image.repository | quay.io/krkn-chaos/krkn | Image repository (core engine) |
| kraken.image.tag | v5.2.15 | Image tag, used when no digest is set |
| kraken.image.digest | sha256:43b3efda... | Image digest, takes precedence over the tag |
| kraken.image.pullPolicy | IfNotPresent | Image pull policy |
| kraken.privileged | false | Run the krkn container as privileged and bind the service account to the privileged SCC |
| kraken.privilegedWorkloads | auto | Give the service account the privileged SCC in privilegedNamespaces (auto: when an enabled scenario needs it) |
| kraken.privilegedNamespaces | [default] | Namespaces where krkn starts its privileged helper pods |
| kraken.runAsUser | "" | User id of the container. Leave empty on OpenShift (assigned by the SCC), set it on plain Kubernetes (ex: 1001) |
| kraken.resources | {} | Resources requests and limits of the krkn container |
| kraken.rbac.clusterAdmin | false | Bind the service account to cluster-admin instead of the chaos ClusterRole of this chart |
| kraken.rbac.extraRules | [] | Rules added to the chaos ClusterRole of this chart |
| kraken.job.name | kraken-test | Job name (prefix of the job names with the hub engine) |
| kraken.job.activeDeadlineSeconds | 7200 | Maximum duration of the job (seconds) |
| kraken.job.suspend | false | Create the job suspended |
| kraken.job.ttlSecondsAfterFinished | "" | Delete the finished job after this delay (seconds), kept when empty |
| kraken.config.exitOnFailure | false | Keep false: krkn reads it only with cerberus enabled and then exits 1 after the first scenario, even on a healthy signal |
| kraken.config.waitDuration | 60 | Duration to wait between each scenario (seconds) |
| kraken.config.iterations | 1 | Number of times to execute the scenarios |
| kraken.config.daemonMode | false | Run the scenarios forever |
| kraken.config.autoRollback | true | Roll back the changes of a scenario that failed |
| kraken.config.imageSignatureVerification | true | Verify the signature of the workload images started by krkn |
| kraken.config.reportFormats | [] | Formats of the report generated at the end of the run (html, pdf) |
| kraken.config.resiliencyRunMode | disabled | Resiliency score mode (standalone, detailed or disabled) |
| kraken.cerberus.enabled | false | Check the cerberus signal after each scenario |
| kraken.cerberus.url | "" | URL of the cerberus signal (ex: http://cerberus.chaos-cerberus.svc.cluster.local:8080) |
| kraken.cerberus.checkApplicationRoutes | false | Fail the run when a route watched by cerberus was unavailable |
| kraken.healthChecks.interval | 2 | Interval of the HTTP health checks run by krkn (seconds) |
| kraken.healthChecks.runDuring | post | When to run the checks (pre, during, post or a list) |
| kraken.healthChecks.exitOnFailure | false | Fail the run when a check fails |
| kraken.healthChecks.endpoints | [] | Endpoints to check (url, bearer_token, auth) |
| kraken.objectStateChecks.runDuring | [] | When to run the object condition checks (list of pre, during, post). Disabled when empty |
Deploy chaos-kraken with OpenTenant
Each tenant gets its own release of this chart, with its own namespace, secrets and domain. The builder below already has chaos-kraken 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.
- Pick a serverConnect Hetzner, OVHcloud or AWS. The builder starts on Hetzner, the cheapest sample rate.
- Place the chartchaos-kraken is pinned at v21.3.418 in opentenant.yaml. Drag more apps from the marketplace onto a rack.
- 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