Skip to main content
Version: 2.8.8

Install Chaos Mesh Offline

This document describes how to install Chaos Mesh offline.

Prerequisites​

Before installing Chaos Mesh, make sure that Docker and Helm are installed and the Kubernetes cluster is deployed in the offline environment. For the supported Kubernetes versions, see Supported Releases. If the environment is not prepared, refer to the following documents to install Docker, Helm, and deploy the Kubernetes cluster:

Helm is also required on the machine with external network connection, because the Helm chart is downloaded with helm pull.

Prepare installation files​

Before you install Chaos Mesh offline, you need to download the Chaos Mesh images and the Helm chart from the machine with external network connection, and then copy the downloaded files into your offline environment.

Specify version number​

Set the Chaos Mesh and DNS image versions as environment variables on the machine with external network connection:

export CHAOS_MESH_VERSION=v2.8.8
export CHAOS_DNS_VERSION=v0.2.8

The DNS image uses its own version. CHAOS_DNS_VERSION matches dnsServer.image.tag in this version of the Helm chart.

Download Chaos Mesh images​

On the machine connected to the external network, pull images using the version number that has been set:

docker pull ghcr.io/chaos-mesh/chaos-mesh:${CHAOS_MESH_VERSION}
docker pull ghcr.io/chaos-mesh/chaos-daemon:${CHAOS_MESH_VERSION}
docker pull ghcr.io/chaos-mesh/chaos-dashboard:${CHAOS_MESH_VERSION}
docker pull ghcr.io/chaos-mesh/chaos-coredns:${CHAOS_DNS_VERSION}

Save images as the tar packages:

docker save ghcr.io/chaos-mesh/chaos-mesh:${CHAOS_MESH_VERSION} > image-chaos-mesh.tar
docker save ghcr.io/chaos-mesh/chaos-daemon:${CHAOS_MESH_VERSION} > image-chaos-daemon.tar
docker save ghcr.io/chaos-mesh/chaos-dashboard:${CHAOS_MESH_VERSION} > image-chaos-dashboard.tar
docker save ghcr.io/chaos-mesh/chaos-coredns:${CHAOS_DNS_VERSION} > image-chaos-coredns.tar
info

The Helm chart enables the DNS server by default. Include the chaos-mesh/chaos-coredns image in the offline files, even if you do not plan to run DNSChaos. If you explicitly set dnsServer.create=false, you can omit this image.

Download the Helm chart​

On the machine connected to the external network, download the Helm chart from the Chaos Mesh charts repository:

helm repo add chaos-mesh https://charts.chaos-mesh.org
helm pull chaos-mesh/chaos-mesh --untar --version 2.8.8

The chart is downloaded and extracted to the chaos-mesh directory.

Copy files​

After downloading all the files required for installation, you need to copy these files to the offline environment:

  • image-chaos-mesh.tar
  • image-chaos-daemon.tar
  • image-chaos-dashboard.tar
  • image-chaos-coredns.tar
  • chaos-mesh (the extracted Helm chart)

Install Chaos Mesh​

After copying the image tar packages and the Helm chart to the offline environment, take the following steps to install Chaos Mesh.

Step 1. Load Chaos Mesh images​

Load images from the tar package:

docker load < image-chaos-mesh.tar
docker load < image-chaos-daemon.tar
docker load < image-chaos-dashboard.tar
docker load < image-chaos-coredns.tar

Step 2. Push images to Registry​

info

Before pushing images to Registry, make sure that Registry has been deployed in the offline environment. If Registry is not deployed, refer to Docker Registry for the deployment method.

Set the image versions and the Registry address as environment variables:

export CHAOS_MESH_VERSION=v2.8.8
export CHAOS_DNS_VERSION=v0.2.8
export DOCKER_REGISTRY=localhost:5000

Mark the images so that they point to the Registry:

export CHAOS_MESH_IMAGE=$DOCKER_REGISTRY/chaos-mesh/chaos-mesh:${CHAOS_MESH_VERSION}
export CHAOS_DAEMON_IMAGE=$DOCKER_REGISTRY/chaos-mesh/chaos-daemon:${CHAOS_MESH_VERSION}
export CHAOS_DASHBOARD_IMAGE=$DOCKER_REGISTRY/chaos-mesh/chaos-dashboard:${CHAOS_MESH_VERSION}
export CHAOS_DNS_IMAGE=$DOCKER_REGISTRY/chaos-mesh/chaos-coredns:${CHAOS_DNS_VERSION}
docker image tag ghcr.io/chaos-mesh/chaos-mesh:${CHAOS_MESH_VERSION} $CHAOS_MESH_IMAGE
docker image tag ghcr.io/chaos-mesh/chaos-daemon:${CHAOS_MESH_VERSION} $CHAOS_DAEMON_IMAGE
docker image tag ghcr.io/chaos-mesh/chaos-dashboard:${CHAOS_MESH_VERSION} $CHAOS_DASHBOARD_IMAGE
docker image tag ghcr.io/chaos-mesh/chaos-coredns:${CHAOS_DNS_VERSION} $CHAOS_DNS_IMAGE

Push images to Registry:

docker push $CHAOS_MESH_IMAGE
docker push $CHAOS_DAEMON_IMAGE
docker push $CHAOS_DASHBOARD_IMAGE
docker push $CHAOS_DNS_IMAGE

Step 3. Install Chaos Mesh using Helm​

Create the namespace:

kubectl create ns chaos-mesh

Execute the installation command. When executing the installation command, you need to specify the namespace of Chaos Mesh and the image values of each component:

helm install chaos-mesh ./chaos-mesh -n=chaos-mesh --set images.registry=$DOCKER_REGISTRY

Verify the installation​

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

kubectl get pods -n chaos-mesh -l app.kubernetes.io/instance=chaos-mesh

The expected output is as follows:

NAME READY STATUS RESTARTS AGE
chaos-controller-manager-7b8c86cc9-44dzf 1/1 Running 0 17m
chaos-controller-manager-7b8c86cc9-mxw99 1/1 Running 0 17m
chaos-controller-manager-7b8c86cc9-xmc5v 1/1 Running 0 17m
chaos-daemon-sg2k2 1/1 Running 0 17m
chaos-dashboard-b9dbc6b68-hln25 1/1 Running 0 17m
chaos-dns-server-546675d89d-qkjqq 1/1 Running 0 17m

If your actual output is similar to the expected output, then Chaos Mesh has been successfully installed.

info

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.

# Take the chaos-controller as an example
kubectl describe po -n chaos-mesh chaos-controller-manager-7b8c86cc9-44dzf
info

If leader election is turned off, chaos-controller-manager should only have 1 replication.

NAME READY STATUS RESTARTS AGE
chaos-controller-manager-676d8567c7-ndr5j 1/1 Running 0 24m
chaos-daemon-6l55b 1/1 Running 0 24m
chaos-dashboard-b9dbc6b68-hln25 1/1 Running 0 44m
chaos-dns-server-546675d89d-qkjqq 1/1 Running 0 44m

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.