Install Chaos Mesh Offline

    Before installing Chaos Mesh, make sure that Docker is installed and the Kubernetes cluster is deployed in the offline environment. If the environment is not prepared, refer to the following documents to install Docker and deploy the Kubernetes cluster:

    Before you install Chaos Mesh offline, you need to download all Chaos Mesh images and repository compression packages from the machines with external network connection, and then copy the downloaded files into your offline environment.

    Set the version number of Chaos Mesh as the environment variable on the machine with external network connection:

    Download Chaos Mesh images

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

    Save images as the tar packages:

    1. docker save ghcr.io/chaos-mesh/chaos-daemon:${CHAOS_MESH_VERSION} > image-chaos-daemon.tar
    2. docker save ghcr.io/chaos-mesh/chaos-dashboard:${CHAOS_MESH_VERSION} > image-chaos-dashboard.tar

    note

    To simulate a DNS fault (for example, make the DNS responses return a random wrong IP address), you need to pull the additional images.

    On the machine connected to the external network, download the zip package of Chaos Mesh:

    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
    • chaos-mesh.zip

    Load images from the tar package:

    1. docker load < image-chaos-mesh.tar
    2. docker load < image-chaos-daemon.tar
    3. docker load < image-chaos-dashboard.tar

    Step 2. Push images to Registry

    Install Chaos Mesh Offline - 图2note

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

    Set the Chaos Mesh version and the Registry address as the environment variable:

    Mark the images so that the images point to the Registry:

    1. export CHAOS_MESH_IMAGE=$DOCKER_REGISTRY/chaos-mesh/chaos-mesh:${CHAOS_MESH_VERSION}
    2. export CHAOS_DAEMON_IMAGE=$DOCKER_REGISTRY/chaos-mesh/chaos-daemon:${CHAOS_MESH_VERSION}
    3. export CHAOS_DASHBOARD_IMAGE=$DOCKER_REGISTRY/chaos-mesh/chaos-dashboard:${CHAOS_MESH_VERSION}
    4. docker image tag ghcr.io/chaos-mesh/chaos-daemon:${CHAOS_MESH_VERSION} $CHAOS_DAEMON_IMAGE
    5. docker image tag ghcr.io/chaos-mesh/chaos-dashboard:${CHAOS_MESH_VERSION} $CHAOS_DASHBOARD_IMAGE

    Push images to Registry:

    Unpack the zip package of Chaos Mesh:

    1. unzip chaos-mesh.zip -d chaos-mesh && cd chaos-mesh

    note

    When installing Chaos Mesh on Kubernetes v1.15(or an earlier version), you need to manually install CRD first by using kubectl create -f manifests/crd-v1beta1.yaml. For more information, see .

    1. 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 value of each component:

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

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

    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, , RESTARTS, and AGE, it means that Helm is installed successfully.

    Install Chaos Mesh Offline - 图4note

    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.

    1. # Take the chaos-controller as an example
    2. kubectl describe po -n chaos-mesh chaos-controller-manager-69fd5c46c8-xlqpc

    note

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

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

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