Install Chaos Mesh using Helm (Recommended for Production Environments)

This document describes how to install Chaos Mesh in the production environment.

Before installing Chaos Mesh, make sure that you have installed Helm in your environment.

To check whether Helm is installed or not, execute the following command:

The expected output is as follows:

If your actual output is similar to the expected output with Version, GitCommit, GitTreeState, and GoVersion, it means that Helm is installed successfully.

note

In this document, Helm v3 is used in commands to make operations on Chaos Mesh. If Helm v2 is used in your environment, refer to Migrate Helm v2 to v3 or modify the Helm version to the v2 format.

Install Chaos Mesh using Helm

Add the Chaos Mesh repository to the Helm repository:

  1. helm repo add chaos-mesh https://charts.chaos-mesh.org

Step 2: View the installable versions of Chaos Mesh

To see charts that can be installed, execute the following command:

  1. helm search repo chaos-mesh
note

The above command will output the latest release of chart. If you want to install a historical version, execute the following command to view all released versions:

It is recommended to install Chaos Mesh under the chaos-testing namespace, or you can specify any namespace to install Chaos Mesh:

  1. kubectl create ns chaos-testing

Step 4: Install Chaos Mesh in different environments

note

When installing Chaos Mesh on Kubernetes v1.15(or an earlier version), you need to manually install CRD. For more information, see FAQ.

Because socket paths are listened to by the daemons of different running containers, you need to set different values for socket paths during installation. You can execute the following installation commands according to different environments.

Docker

Containerd

K3s

CRI-O

note

To install Chaos Mesh of a specific version, add the --version xxx parameter after helm upgrade, for example, --version 2.0.0.

note

To ensure high availability, Chaos Mesh turns on leader-election feature by default. If you do not need to use this feature, you can manually turn it off through .

To check the running status of Chaos Mesh, execute the following command:

  1. kubectl get po -n chaos-testing

The expected output is as follows:

  1. NAME READY STATUS RESTARTS AGE
  2. chaos-controller-manager-69fd5c46c8-xlqpc 3/3 Running 0 2d5h
  3. chaos-daemon-jb8xh 1/1 Running 0 2d5h
  4. chaos-dashboard-98c4c5f97-tx5ds 1/1 Running 0 2d5h

If your actual output is similar to the expected output with NAME, READY, STATUS, RESTARTS, and AGE, it means that Helm is installed successfully.

note

If the STATUS of your actual output is not Running, then execute the following command to check the Pod details, and troubleshoot issues according to the error information.

note
  1. NAME READY STATUS RESTARTS AGE
  2. chaos-controller-manager-69fd5c46c8-xlqpc 1/1 Running 0 2d5h
  3. chaos-daemon-jb8xh 1/1 Running 0 2d5h
  4. chaos-dashboard-98c4c5f97-tx5ds 1/1 Running 0 2d5h

Run Chaos experiments

After verifying that the installation is complete, you can run a Chaos experiment to experience the features of Chaos Mesh.

For the method to run the experiment, it is recommended to refer to Run a Chaos experiment. After successfully creating the experiment, you can observe the running status of the experiment on the Chaos Dashboard.

To upgrade Chaos Mesh, execute the following command:

    note

    To upgrade Chaos Mesh to a specific version, add the --version xxx parameter after helm upgrade, for example, --version 2.0.0.

    note

    If you have upgraded Chaos Mesh in a non-Docker environment, you need to add the corresponding parameters as described in .

    To modify the configuration, set different values according to your need. For example, execute the following command to upgrade and uninstall chaos-dashboard:

    note

    For more values and their usages, refer to .

    caution

    Currently, the latest CustomResourceDefinition (CRD) is not applied during the Helm upgrading, which might cause errors. To avoid this situation, you can apply the latest CRD manually:

    Uninstall Chaos Mesh

    To uninstall Chaos Mesh, execute the following command:

    1. helm uninstall chaos-mesh -n chaos-testing

    How can I disable the safe mode?

    The safe mode is enabled by default. To disable the safe mode, specify as false during the installation or upgrade: