Deploy Litmus on KubeSphere

    The Litmus architecture is as follows. For details about the Litmus architecture, see Litmus Docs.

    This tutorial demonstrates how to deploy Litmus on KubeSphere and create chaos experiments.

    Hands-on Lab

    1. In your workspace, go to App Repositories under App Management, and then click Add.

    2. In the dialog that appears, set a name for the repository (for example, litmus) and enter the URL https://litmuschaos.github.io/litmus-helm/. Click Validate to verify the URL. You will see Deploy Litmus on KubeSphere - 图2 icon if the URL is available. Click OK to continue.

    3. The app repository displays in the list after it is successfully imported.

    1. Log out of the KubeSphere console and log back in as project-regular. In your project, go to Apps under Application Workloads, and then click Create.

    2. In the drop-down list, choose litmus, and then choose litmus-2-0-0-beta.

    3. You can view the app information and chart files. Under Versions, select a specific version and click Install.

    4. Under Basic Information, set a name for the app. Check the app version and the deployment location, and then click Next.

    5. Under App Settings, you can edit the yaml file or directly click Install.

    6. The app displays in the list after you create it successfully.

      It may take a while before Litmus is running. Please wait for the deployment to finish.

    1. Go to Services under Application Workloads, copy the NodePort of litmusportal-frontend-service.

    2. You can access Litmus Portal through using the default username and password (admin/litmus).

      litmus-login-1

      Note

    The Litmus Agent can be classified into Self-Agent and External-Agent. By default, the cluster where Litmus is installed is automatically registered as Self-Agent, and Portal defaults to run chaos experiments in Self-Agent.

    For details about how to deploy External Agent, see Litmus Docs.

    • Experiment 1
    1. You need to create a test application on your cluster. For example, you can deploy nginx using the following command:

    2. Log in to Litmus Portal, and then click Schedule workflow.

    3. Choose Create a new workflow using the experiments from MyHub. In the drop-down list, select Chaos Hub, and then click Next.

    4. Set a name for the workflow (for example, pod-delete). You can also add a description for the workflow. Click Next.

    5. Click Add a new experiment to add a chaos experiment to the workflow. Click Next.

    6. Select a point to adjust the weight of the experiment in the workflow. Click Next.

    7. Choose Schedule now, and then click Next.

    8. Verify the workflow, and then click Finish.

      On the KubeSphere console, you can see that a Pod is being deleted and recreated.

      On the Litmus Portal, you can see that the experiment is successful.

      litmus-successful

      You can click a specific workflow node to view its detailed logs.

    • Experiment 2
    1. Perform steps 1 to 10 in Experiment 1 to create a new chaos experiment (pod-cpu-hog). Deploy Litmus on KubeSphere - 图8

    2. On the KubeSphere console, you can see that the pod CPU usage is close to 1 core.

    • Experiment 3
    1. Set the nginx replica to 1. You can see there is only one pod left and view the Pod IP address.

    2. Perform steps 1 to 10 in Experiment 1 to create a new chaos experiment ().

      You can ping the Pod IP address to test the packet loss rate.

      packet-loss-rate

      The preceding experiments are conducted on Pods. You can also experiment on nodes and other Kubernetes components. For details about the chaos experiments, see .