【Chaos Mesh官方文档】Quick Start

Quick Start (Test Recommended)

快速开始(建议用于测试)

This document describes how to quickly start Chaos Mesh in a test or local environment.这篇文章介绍如何在测试或本地环境开始CM

note

In this document, the Chaos Mesh installation is a script installation for quick trial only.

If you need to install Chaos Mesh in the production environment or other strict non-test scenarios, it is recommended to use Helm. For details, refer to Installation using Helm (recommended for production).

注意:

在这篇文档,CM的安装只是一个用于快速尝试的脚本安装。

如果你在生产环境或者严格的非测试场景,建议使用Helm,更多细节参见使用Helm安装Chaos Mesh

 Environment preparation

环境准备
Please ensure that the Kubernetes cluster is deployed in the environment before the trial. If the Kubernetes cluster has not been deployed, you can refer to the links below to complete the deployment:请确认K8s集群在尝试前已经在环境中部署完成。如果K8s集群没有部署,你可以参考下面链接完成部署
Quick installation快速安装
To install Chaos Mesh in a test environment, run the following script:通过执行下面脚本在测试环境安装CM
curl -sSL https://mirrors.chaos-mesh.org/v2.1.5/install.sh | bash

note

  • If the current environment is kind, add the --local kind parameter at the end of the script.

注意:

如果当前环境是kind,在脚本末尾添加--local kind参数

curl -sSL https://mirrors.chaos-mesh.org/v2.1.5/install.sh | bash -s -- --local kind
If you want to specify a kind version, add the --kind-version xx parameter at the end of the script, for example:如果你想指定kind版本,在脚本末尾添加--kind-version:xx参数,例如
curl -sSL https://mirrors.chaos-mesh.org/v2.1.5/install.sh | bash -s -- --local kind --kind-version v0.10.0

If the current environment is K3s, add the --k3s parameter at the end of the script.

curl -sSL https://mirrors.chaos-mesh.org/v2.1.5/install.sh | bash -s -- --k3s

If the current environment is Microk8s, add the --microk8s parameter at the end of the script.

curl -sSL https://mirrors.chaos-mesh.org/v2.1.5/install.sh | bash -s -- --microk8s

tip

To speed up the image pulling process, users in the Chinese mainland can add the --docker-mirror parameter at the end of the script. After adding this parameter, the install.sh script pulls images from dockerhub.azk8s.cn and gcr.azk8s.cn.

After running this script, Chaos Mesh automatically installs the CustomResourceDefining (CRD) that matches the version, all required components, and related Service Account configurations.

For more installation details, refer to the source code of the install.sh.

 Verify the installation

验证安装
To check the running status of Chaos Mesh, execute the following command:执行下面指令检查CM运行状态
kubectl get po -n chaos-testing
The expected output is as follows:期望如下输出
NAME                                        READY   STATUS    RESTARTS   AGE
chaos-controller-manager-69fd5c46c8-xlqpc   3/3     Running   0          2d5h
chaos-daemon-jb8xh                          1/1     Running   0          2d5h
chaos-dashboard-98c4c5f97-tx5ds             1/1     Running   0          2d5h
If your actual output is similar to the expected output with NAME, READY, STATUS, RESTARTS, and AGE, it means that Helm is installed successfully.如果你的实际输出的NAME,READY,STATUS,RESTARTS和AGE和期望的类似,说明helm成功的安装了

note

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.

注意:

如果你的实际输出STAUTS不是Running,那么执行西面的命令检查Pod的细节然后根据错误信息解决问题。

# Take the chaos-controller as an example
kubectl describe po -n chaos-testing chaos-controller-manager-69fd5c46c8-xlqpc

note

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

注意:

如果leader-election特性手工关闭了,chaos-controller-manager应当只有一个副本

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

 Run Chaos experiments

运行混沌实验
After verifying that the installation is complete, you can run a Chaos experiment to experience the features of Chaos Mesh.在验证安装已经完成后,你可以运行一个混沌测试来体验CM的特性

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.

建议参考运行一个混沌实验来运行实验,在成功创建实验,你可以从混沌看板观察实验运行状态
Uninstall Chaos Mesh卸载CM
To uninstall Chaos Mesh, execute the following command:执行下面命令卸载CM
curl -sSL https://mirrors.chaos-mesh.org/v2.1.5/install.sh | bash -s -- --template | kubectl delete -f -
You can also delete the chaos-testing namespace to directly uninstall Chaos Mesh:你也可以直接删除chaos-testing命名空间来删除CM
kubectl delete ns chaos-testing

 FAQ

问答

 Why the local directory appears in the root directory after installation?

为什么在安装后根目录里有local文件夹
If you don't install kind in the existing environment, and you use the --local kind parameter when executing the installation command, the install.sh script will automatically install the kind in the local directory under the root directory.如果当前环境不安装kind,并且你在执行安装指令时使用--local kind参数,install.sh脚本会自动在根目录的local文件夹里安装kind
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值