Offline Installation

This document describes how to install Chaos Mesh in an offline environment.

Prerequisites

Before deploying Chaos Mesh, make sure the following items have been installed:

  • Kubernetes version >= 1.12
  • RBAC enabled (optional)
  • Docker

Prepare the installation file

To install Chaos Mesh offline, you need to get the installation images via an internet connection. Take the steps below:

  1. Specify the version you want to install:

    1. export CHAOS_MESH_VERSION="v1.1.0"
  1. > **Note:**
  2. >
  3. > It is recommended that you use a stable release, or you can set the version to `latest` if you want to experience the latest features that are under development.
  1. Archive the docker images of Chaos Mesh:

    1. docker pull pingcap/chaos-mesh:${CHAOS_MESH_VERSION}
    2. docker pull pingcap/chaos-daemon:${CHAOS_MESH_VERSION}
    3. docker pull pingcap/chaos-dashboard:${CHAOS_MESH_VERSION}
    4. docker pull pingcap/coredns:v0.2.0
  1. ```
  2. docker save -o ./image-chaos-mesh pingcap/chaos-mesh:${CHAOS_MESH_VERSION}
  3. docker save -o ./image-chaos-daemon pingcap/chaos-daemon:${CHAOS_MESH_VERSION}
  4. docker save -o ./image-chaos-dashboard pingcap/chaos-dashboard:${CHAOS_MESH_VERSION}
  5. docker save -o ./image-chaos-coredns pingcap/coredns:v0.2.0
  6. ```
  1. Download the Chaos Mesh repository to your local:

    1. wget "https://github.com/chaos-mesh/chaos-mesh/archive/${CHAOS_MESH_VERSION}.zip"
  1. Or you can download the latest unstable version:
  2. ```
  3. wget https://github.com/chaos-mesh/chaos-mesh/archive/master.zip
  4. ```
  1. the ./image-chaos-mesh, ./image-chaos-daemon, ./image-chaos-dashboard, and {CHAOS_MESH_VERSION}.zip into the offline environment.

Install Chaos Mesh offline

Now that you already have the image and repo archive files in the offline environment, start installing Chaos Mesh.

  1. Specify the version you are going to install in the offline environment:

    1. export CHAOS_MESH_VERSION="v1.1.0"
  1. Load the image from the archive files:

    1. docker load -i ./image-chaos-mesh
    2. docker load -i ./image-chaos-daemon
    3. docker load -i ./image-chaos-dashboard
    4. docker load -i ./image-chaos-coredns
  1. Push the Chaos Mesh images. You can choose to push them to Docker Registry or Docker Hub.

    • Push images to Docker Registry

      a. Set the Docker Registry variable, for example:

      1. export DOCKER_REGISTRY=localhost:5000
  1. b. Tag these images with `$DOCKER_REGISTRY`:
  2. ```
  3. export CHAOS_MESH_IMAGE=$DOCKER_REGISTRY/pingcap/chaos-mesh:${CHAOS_MESH_VERSION}
  4. export CHAOS_DAEMON_IMAGE=$DOCKER_REGISTRY/pingcap/chaos-daemon:${CHAOS_MESH_VERSION}
  5. export CHAOS_DASHBOARD_IMAGE=$DOCKER_REGISTRY/pingcap/chaos-dashboard:${CHAOS_MESH_VERSION}
  6. export CHAOS_COREDNS_IMAGE=$DOCKER_REGISTRY/pingcap/coredns:v0.2.0
  7. docker image tag pingcap/chaos-mesh:${CHAOS_MESH_VERSION} $CHAOS_MESH_IMAGE
  8. docker image tag pingcap/chaos-daemon:${CHAOS_MESH_VERSION} $CHAOS_DAEMON_IMAGE
  9. docker image tag pingcap/chaos-dashboard:${CHAOS_MESH_VERSION} $CHAOS_DASHBOARD_IMAGE
  10. docker image tag pingcap/coredns:v0.2.0 $CHAOS_COREDNS_IMAGE
  11. ```
  12. c. Push these images to Docker Registry:
  13. ```
  14. docker push $CHAOS_MESH_IMAGE
  15. docker push $CHAOS_DAEMON_IMAGE
  16. docker push $CHAOS_DASHBOARD_IMAGE
  17. docker push $CHAOS_COREDNS_IMAGE
  18. ```
  19. > **Note:**
  20. >
  21. > If the Docker Registry can only work locally, you need to load and push these images on each K8s node.
  22. - Push images to Docker Hub
  23. a. Set the Docker Hub variable, for example:
  24. ```
  25. export DOCKER_HUB=hub
  26. ```
  27. b. Tag these images with `$DOCKER_REGISTRY`:
  28. ```
  29. export CHAOS_MESH_IMAGE=$DOCKER_HUB/chaos-mesh:${CHAOS_MESH_VERSION}
  30. export CHAOS_DAEMON_IMAGE=$DOCKER_HUB/chaos-daemon:${CHAOS_MESH_VERSION}
  31. export CHAOS_DASHBOARD_IMAGE=$DOCKER_HUB/chaos-dashboard:${CHAOS_MESH_VERSION}
  32. export CHAOS_COREDNS_IMAGE=$DOCKER_HUB/coredns:v0.2.0
  33. docker image tag pingcap/chaos-mesh:${CHAOS_MESH_VERSION} $CHAOS_MESH_IMAGE
  34. docker image tag pingcap/chaos-daemon:${CHAOS_MESH_VERSION} $CHAOS_DAEMON_IMAGE
  35. docker image tag pingcap/chaos-dashboard:${CHAOS_MESH_VERSION} $CHAOS_DASHBOARD_IMAGE
  36. docker image tag pingcap/coredns:v0.2.0 $CHAOS_COREDNS_IMAGE
  37. ```
  38. c. Push these images to Docker Registry:
  39. ```
  40. docker push $CHAOS_MESH_IMAGE
  41. docker push $CHAOS_DAEMON_IMAGE
  42. docker push $CHAOS_DASHBOARD_IMAGE
  43. docker push $CHAOS_COREDNS_IMAGE
  44. ```
  1. Install Chaos Mesh offline with the following steps:

    a. Unzip the repo archive files to a path:

    1. unzip ${CHAOS_MESH_VERSION}.zip -d chaos-mesh && cd chaos-mesh/*/
  1. b. Create a namespace for installing Chaos Mesh:
  2. ```
  3. kubectl create namespace chaos-testing
  4. ```
  5. c. Install Chaos Mesh by helm:
  6. ```
  7. helm install chaos-mesh helm/chaos-mesh --namespace=chaos-testing \
  8. --set dashboard.create=true \
  9. --set dnsServer.create=true \
  10. --set chaosDaemon.image=$CHAOS_DAEMON_IMAGE \
  11. --set controllerManager.image=$CHAOS_MESH_IMAGE \
  12. --set dashboard.image=$CHAOS_DASHBOARD_IMAGE \
  13. --set dnsServer.image=${CHAOS_COREDNS_IMAGE}
  14. ```
  15. d. Check whether Chaos Mesh pods are installed:
  16. ```
  17. kubectl get pods --namespace chaos-testing -l app.kubernetes.io/instance=chaos-mesh
  18. ```
  19. Expected output:
  20. ```
  21. NAME READY STATUS RESTARTS AGE
  22. chaos-controller-manager-6d6d95cd94-kl8gs 1/1 Running 0 3m40s
  23. chaos-daemon-5shkv 1/1 Running 0 3m40s
  24. chaos-dashboard-d998856f6-vgrjs 1/1 Running 0 3m40s
  25. ```
  26. After executing the above commands, you should be able to see the output indicating that all Chaos Mesh pods are up and running. Otherwise, check the current environment according to the prompt message or create an [issue](https://github.com/chaos-mesh/chaos-mesh/issues) for help.