title |
---|
Install Chaos Mesh using Helm (Recommended for Production Environments) |
import PickVersion from '@site/src/components/PickVersion' import PickHelmVersion from '@site/src/components/PickHelmVersion'
import VerifyInstallation from './common/verify-installation.md' import QuickRun from './common/quick-run.md'
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:
helm version
The expected output is as follows:
version.BuildInfo{Version:"v3.5.4", GitCommit:"1b5edb69df3d3a08df77c9902dc17af864ff05d1", GitTreeState:"dirty", GoVersion: "go1.16.3"}
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.
:::
Add the Chaos Mesh repository to the Helm repository:
helm repo add chaos-mesh https://charts.chaos-mesh.org
To see charts that can be installed, execute the following command:
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:
helm search repo chaos-mesh -l
:::
After the above command is completed, you can start installing Chaos Mesh.
It is recommended to install Chaos Mesh under the chaos-testing
namespace, or you can specify any namespace to install Chaos Mesh:
kubectl create ns chaos-testing
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.
{\# Default to /var/run/docker.sock helm install chaos-mesh chaos-mesh/chaos-mesh -n=chaos-testing --version latest
}
{helm install chaos-mesh chaos-mesh/chaos-mesh -n=chaos-testing --set chaosDaemon.runtime=containerd --set chaosDaemon.socketPath=/run/containerd/containerd.sock --version latest
}
{helm install chaos-mesh chaos-mesh/chaos-mesh -n=chaos-testing --set chaosDaemon.runtime=containerd --set chaosDaemon.socketPath=/run/k3s/containerd/containerd.sock --version latest
}
:::note
To install Chaos Mesh of a specific version, add the --version xxx
parameter after helm upgrade
, for example, --version 2.0.0
.
:::
To upgrade Chaos Mesh, execute the following command:
helm upgrade chaos-mesh chaos-mesh/chaos-mesh
:::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 Step 4: Install Chaos Mesh in different environments.
:::
To modify the configuration, set different values according to your need. For example, execute the following command to upgrade and uninstall chaos-dashboard
:
{helm upgrade chaos-mesh chaos-mesh/chaos-mesh -n=chaos-testing --version latest --set dashboard.create=false
}
:::note
For more values and their usages, refer to all values.
:::
:::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:
curl -sSL https://mirrors.chaos-mesh.org/latest/crd.yaml | kubectl apply -f -:::
To uninstall Chaos Mesh, execute the following command:
helm uninstall chaos-mesh -n chaos-testing
The helm/chaos-mesh/values.yaml
file defines the image of the latest version (the master branch). To install the latest version of Chaos Mesh, execute the following command:
# Clone repository
git clone https://github.com/chaos-mesh/chaos-mesh.git
cd chaos-mesh
helm install chaos-mesh helm/chaos-mesh -n=chaos-teting
The safe mode is enabled by default. To disable the safe mode, specify dashboard.securityMode
as false
during the installation or upgrade:
{helm install chaos-mesh helm/chaos-mesh -n=chaos-testing --set dashboard.securityMode=false --version latest
}