当前位置: 首页 > news >正文

Chaos Mesh云原生的混沌测试平台搭建

Chaos Mesh云原生的混沌测试平台搭建

一.环境准备

​ 确认已经安装helm,如要查看 Helm 是否已经安装,请执行如下命令:

helm version

image-20241216141133264

二.使用helm安装

1.添加 Chaos Mesh 仓库

​ 在 Helm 仓库中添加 Chaos Mesh 仓库:

helm repo add chaos-mesh https://charts.chaos-mesh.org
2.查看可以安装的 Chaos Mesh 版本
#最新版
helm search repo chaos-mesh
#可查看历史版本
helm search repo chaos-mesh -l

如图:image-20241216151042116

3.安装 Chaos Mesh
#创建命名空间
kubectl create ns chaos-mesh

​ 因为在安装部署Chaos Mesh的时候,会涉及到k8s拉取不到镜像,或者需要自定义其他配置。所以在部署的时候可以指定values.yml文件。

​ 进入这个网站:chaos-mesh/helm/chaos-mesh at release-2.7 · chaos-mesh/chaos-mesh,找到自己对应安装的版本。

image-20241216152534469

找到该目录的values.yaml文件,然后复制里面需要修改的内容,在本地新建一个文件进行对应的调整。

如图是一些可能修改的点,要注意复制修改的时候,需要把一些必要的上下文一起复制,注意缩进。

image-20241216153241436

下面是自己的例子,主要是修改了镜像地址和时区:

rbac:create: true# timezone is the timezone where controller-manager, chaos-daemon and dashboard uses.
# For example: "UTC" or "Asia/Shanghai"
# This value will be set on controller-manager and dashboard container's
# environment variable TZ.
# You may need to set the timezone to be consistent with your Grafana configuration,
# otherwise the query Grafana used to retrieve event maybe in wrong timezone.
timezone: "Asia/Shanghai"images:# images.registry is the global container registry for the images, you could replace it with your self-hosted container registry.registry: "registry.cn-hangzhou.aliyuncs.com"# images.tag is the global image tag (for example, semiVer with prefix v, or latest).tag: "v2.7.0"controllerManager:# securityContext if neededsecurityContext: {}# running chaos-controller-manager on host networkhostNetwork: false# Allow testing on `hostNetwork` pods. This is Dangerous. Please run only as temporary solution.allowHostNetworkTesting: false# The serviceAccount for chaos-controller-managerserviceAccount: chaos-controller-manager# ServiceAccount annotations for chaos-controller-managerserviceAccountAnnotations: {}# Create the serviceAccount for chaos-controller-managerserviceAccountCreate: true# Custom priorityClassName for using pod prioritiespriorityClassName: ""# Replicas for chaos-controller-managerreplicaCount: 3# image would be constructed by <registry>/<repository>:<tag>image:# override global registry, empty value means using the global images.registryregistry: ""# repository part for image of chaos-controller-managerrepository: <阿里云镜像仓库地址>/chaos-mesh# override global tag, empty value means using the global images.tagtag: ""# Image pull policyimagePullPolicy: IfNotPresent# The keys within the "env" map are mounted as environment variables on the pod.env:# WEBHOOK_PORT is configured the port for chaos-controller-manager provides webhooks.# In GKE private clusters, by default kubernetes apiservers are allowed to# talk to the cluster nodes only on 443 and 10250. so configuring# WEBHOOK_PORT: 10250, will work out of the box without needing to add firewall# rules or requiring NET_BIND_SERVICE capabilities to bind port numbers <1000WEBHOOK_PORT: 10250# METRICS_PORT is configured the port for chaos-controller-manager exposing prometheus metricsMETRICS_PORT: 10080# If enabled, only pods in the namespace annotated with `"chaos-mesh.org/inject": "enabled"` could be injectedenableFilterNamespace: false# targetNamespace only works with clusterScoped is false(namespace scoped mode).# It means namespace which will be injected chaostargetNamespace: chaos-meshservice:# Kubernetes Service type for service chaos-controller-managertype: ClusterIPresources:# We usually recommend not to specify default resources and to leave this as a conscious# choice for the user. This also increases chances charts run on environments with little# resources, such as Minikube. If you do want to specify resources, uncomment the following# lines, adjust them as necessary, and remove the curly braces after 'resources:'.limits: {}#  cpu: 500m#  memory: 1024Mirequests:cpu: 25mmemory: 256Mi# Node labels for chaos-controller-manager pod assignmentnodeSelector: {}# Toleration labels for chaos-controller-manager pod assignmenttolerations: []# Map of chaos-controller-manager node/pod affinitiesaffinity: {}# Pod annotations of chaos-controller-managerpodAnnotations: {}# A list of controllers to enable. "*" enables all controllers by default.enabledControllers:- "*"# A list of webhooks to enable. "*" enables all webhooks by default.enabledWebhooks:- "*"podChaos:podFailure:# Custom Pause Container Image for Pod Failure ChaospauseImage: registry.cn-hangzhou.aliyuncs.com/<阿里云镜像仓库地址>/pause:latestleaderElection:# Enable leader election for controller manager.enabled: true# The duration that non-leader candidates will wait to force acquire leadership. This is measured against time of last observed ack.leaseDuration: 15s# The duration that the acting control-plane will retry refreshing leadership before giving up.renewDeadline: 10s# The duration the LeaderElector clients should wait between tries of actions.retryPeriod: 2s# chaosdSecurityMode is enabled for mTLS connection between chaos-controller-manager and chaosdchaosdSecurityMode: true# multi cluster install offline helm chart pathlocalHelmChart:enabled: falsevolume:hostPath:path: /data/helmtype: DirectoryOrCreatechaosDaemon:# image would be constructed by <registry>/<repository>:<tag>image:# override global registry, empty value means using the global images.registryregistry: ""# repository part for image of chaos-daemonrepository: <阿里云镜像仓库地址>/chaos-daemon# empty tag means using the global images.tagtag: ""# Image pull policyimagePullPolicy: IfNotPresent# The port which grpc server listens on.grpcPort: 31767# The port which http server listens on.httpPort: 31766# extra chaosDaemon envsenv: {}# securityContext if neededsecurityContext: {}# running chaosDaemon on host networkhostNetwork: false# configurations about mtls.# currently we do not support use specified ca and cert for mtls, it would generate the ca and certs when chaos mesh deploy by helm.mtls:# enable mtls on the grpc connection between chaos-controller-manager and chaos-daemonenabled: trueruntime: containerdsocketPath: /run/containerd/containerd.sockdashboard:# Enable chaos-dashboardcreate: true# Optional, the secret name that has `DATABASE_DATASOURCE` defined.# It's recommended to use a secret to store the database credentials.databaseSecretName: ""# rootUrl specify the base url for openid/oauth2 (like GCP Auth Integration) callback URL.rootUrl: http://localhost:2333# securityContext if neededsecurityContext: {}# running chaos-dashboard on host networkhostNetwork: false# replicas of chaos-dashboardreplicaCount: 1# Custom priorityClassName for using pod prioritiespriorityClassName: ""# The serviceAccount for chaos-dashboardserviceAccount: chaos-dashboardimage:# override global registry, empty value means using the global images.registryregistry: ""# repository part for image of chaos-dashboardrepository: <阿里云镜像仓库地址>/chaos-dashboard# override global tag, empty value means using the global images.tagtag: ""# Image pull policyimagePullPolicy: IfNotPresent# securityMode requires user to provide credentials on Chaos Dashboard, instead of using chaos-dashboard service accountsecurityMode: truednsServer:# Enable DNS Server which required by DNSChaoscreate: true# Name of serviceaccount for chaos-dns-server.serviceAccount: chaos-dns-server# image would be constructed by <registry>/<repository>:<tag>image:# override global registry, empty value means using the global images.registryregistry: ""# repository part for image of chaos-dns-serverrepository: chaos-mesh/chaos-coredns# override global tag, empty value means using the global images.tagtag: "v0.2.6"# Image pull policyimagePullPolicy: IfNotPresent# Customized priorityClassName for chaos-dns-serverpriorityClassName: ""dnsServer:# Enable DNS Server which required by DNSChaoscreate: true# Name of serviceaccount for chaos-dns-server.serviceAccount: chaos-dns-server# image would be constructed by <registry>/<repository>:<tag>image:# override global registry, empty value means using the global images.registryregistry: ""# repository part for image of chaos-dns-serverrepository: <阿里云镜像仓库地址>/chaos-coredns# override global tag, empty value means using the global images.tagtag: "v0.2.6"# Image pull policyimagePullPolicy: IfNotPresent# Customized priorityClassName for chaos-dns-serverpriorityClassName: ""

在修改完镜像地址等等东西之后,就可以执行命令部署。

helm install chaos-mesh -f chaos_mesh_values.yaml chaos-mesh/chaos-mesh --namespace=chaos-mesh --create-namespace

-f 后面是自己修改的values配置文件

检查是否部署成功

kubectl get po -n chaos-mesh

image-20241216160418158

4.访问Chaos Mesh

访问地址是<集群IP>:30768,如图。

image-20241216161440545

Chaos MeshRBAC 鉴权:

image-20241216170325685

image-20241216170310725

按如下步骤选择好命名空间和角色之后,点击自动生成的文件创建即可。

这里要注意:

kubectl create token account-default-viewer-ixqbu

这个命令生成的token是有过期时效的。所以我们还有一个方法可以生成长期可用的token。

apiVersion: v1
kind: Secret
metadata:name: account-test-manager-sequd-tokennamespace: testannotations:kubernetes.io/service-account.name: account-default-viewer-ixqbu
type: kubernetes.io/service-account-token

注意此处的kubernetes.io/service-account.name:和上一步创建的角色名字相同.

#查看secretskubectl describe secrets -n test account-test-manager-sequd-token

image-20241216174337082

输入环境名和token就可以成功创建实验了。

三.创建测试实验

1.选择实验方法设置实验条件

image-20241216183310384

image-20241216183337441

这里Workers代表进程,这里是三个进程对Pod施加100M的压力。

image-20241216183515998

这里可以配置标签选择器和命名空间,以确定哪些Pod参与此次实验。

image-20241216183622920

此处要注意,当最后一步提交的时候,如果没有反应。报错信息则需要在F12里看具体的接口报错。此处报错信息在Pod日志 里无法看见。

a lowercase RFC 1123 subdomain must consist of lower case alphanumeric characters, ‘-’ or ‘.’

这里可以看到失败的原因是实验名称必须小写且不能有除这些字符以外的特殊字符。

image-20241216183924917image-20241216184010293

修改之后则可以正常提交。

2.检查实验结果

在提交了实验之后,我们可以看到实验正在进行。

image-20241216184038884

此时进入容器内部top,可以看到会有其他的进程对该pod施加内存压力,则证明Chaos Mesh安装成功可以如期进行实验

image-20241216184108052

相关文章:

Chaos Mesh云原生的混沌测试平台搭建

Chaos Mesh云原生的混沌测试平台搭建 一.环境准备 ​ 确认已经安装helm&#xff0c;如要查看 Helm 是否已经安装&#xff0c;请执行如下命令&#xff1a; helm version二.使用helm安装 1.添加 Chaos Mesh 仓库 ​ 在 Helm 仓库中添加 Chaos Mesh 仓库&#xff1a; helm re…...

Vue3之组合式API详解

Vue 3引入了一种新的API风格——组合式API&#xff08;Composition API&#xff09;&#xff0c;旨在提升组件的逻辑复用性和可维护性。本文将详细阐述Vue 3中的组合式API&#xff0c;包括其定义、特点、使用场景、优势等&#xff0c;并给出具体的示例代码。 一、定义 组合式…...

大模型的构建与部署(3)——数据标注

版权声明 本文原创作者:谷哥的小弟作者博客地址:http://blog.csdn.net/lfdfhl1. 数据标注的重要性 1.1 增强数据可解释性 数据标注通过为原始数据添加标签或注释,显著增强了数据的可解释性。在机器学习和深度学习领域,模型的训练依赖于大量带标签的数据。这些标签不仅帮助…...

AI发展与LabVIEW程序员就业

人工智能&#xff08;AI&#xff09;技术的快速发展确实对许多行业带来了变革&#xff0c;包括自动化、数据分析、软件开发等领域。对于LabVIEW程序员来说&#xff0c;AI的崛起确实引发了一个值得关注的问题&#xff1a;AI会不会取代他们的工作&#xff0c;导致大量失业&#x…...

本地事务 + 消息队列事务方案设计

Spring Boot 和 RocketMQ 在Spring Boot项目中实现“本地事务 消息队列事务”的方案&#xff0c;可以按照以下步骤实现&#xff1a; 先执行MySQL本地事务操作&#xff08;未提交&#xff09;随后发送消息到消息队列&#xff08;如RocketMQ事务消息&#xff09;等待消息队列确…...

pinctrl子系统学习笔记

一、背景 cpu的gpio引脚可以复用成多个功能&#xff0c;如可以配置成I2C或者普通GPIO模式。配置方式一般是通过写引脚复用的配置寄存器&#xff0c;但是不同芯片厂商配置寄存器格式内容各不相同&#xff0c;设置引脚复用无法做到通用且自由的配置&#xff0c;只能在启动初始化…...

使用vue-element 的计数器inputNumber,传第三个参数

使用vue-element 的计数器inputNumber。 其中的change 事件中&#xff0c;默认自带两个参数&#xff0c;currentValue和oldValue&#xff0c;分别代表改变后的数和改变前的数&#xff0c; 如果想要传第三个参数&#xff0c; change"(currentValue, oldValue) > numCha…...

如何从0构建一个flask项目,直接上实操!!!

项目结构 首先&#xff0c;创建一个项目目录&#xff0c;结构如下&#xff1a; flask_app/ │ ├── app.py # Flask 应用代码 ├── static/ # 存放静态文件&#xff08;如CSS、JS、图片等&#xff09; │ └── style.css # 示例…...

Mongoose连接数据库操作实践

文章目录 介绍特点&#xff1a;Mongoose 使用&#xff1a;创建项目并安装&#xff1a;连接到 MongoDB&#xff1a;定义 Schema&#xff1a;创建模型并操作数据库&#xff1a;创建文档&#xff1a;查询文档&#xff1a;更新文档&#xff1a;删除文档&#xff1a;使用钩子&#x…...

centos 7.9 freeswitch1.10.9环境搭建

亲测版本centos 7.9系统–》 freeswitch1.10.9 一、下载插件 yum install -y git alsa-lib-devel autoconf automake bison broadvoice-devel bzip2 curl-devel libdb4-devel e2fsprogs-devel erlang flite-devel g722_1-devel gcc-c++ gdbm-devel gnutls-devel ilbc2...

Gitlab服务管理和仓库项目权限管理

Gitlab服务管理 gitlab-ctl start # 启动所有 gitlab 组件&#xff1b; gitlab-ctl stop # 停止所有 gitlab 组件&#xff1b; gitlab-ctl restart # 重启所有 gitlab 组件&#xff1b; gitlab-ctl status …...

LLMs之Llama-3:Llama-3.3的简介、安装和使用方法、案例应用之详细攻略

LLMs之Llama-3&#xff1a;Llama-3.3的简介、安装和使用方法、案例应用之详细攻略 目录 相关文章 LLMs之LLaMA&#xff1a;LLaMA的简介、安装和使用方法、案例应用之详细攻略 LLMs之LLaMA-2&#xff1a;LLaMA 2的简介(技术细节)、安装、使用方法(开源-免费用于研究和商业用途…...

OpenCV函数及其应用

1. 梯度处理的Sobel算子函数 功能 Sobel算子是一种用于边缘检测的离散微分算子&#xff0c;它结合了高斯平滑和微分求导&#xff0c;用于计算图像亮度的空间梯度。 参数 src&#xff1a;输入图像。 dst&#xff1a;输出图像。 ddepth&#xff1a;输出图像的深度。 dx&#xff…...

vulnhub靶场【DriftingBlues】之3

前言 靶机&#xff1a;DriftingBlues-3&#xff0c;IP地址192.168.1.60 攻击&#xff1a;kali&#xff0c;IP地址192.168.1.16 都采用虚拟机&#xff0c;网卡为桥接模式 主机发现 使用arp-scan -l或netdiscover -r 192.168.1.1/24 信息收集 使用nmap扫描端口 网站探测 访…...

文件上传—阿里云OSS对象存储

目录 一、OSS简介 二、OSS基本使用 1. 注册账号 2. 基本配置 (1) 开通OSS (2) 创建存储空间 (3) 修改权限 (4) 配置完成&#xff0c;上传一张图片&#xff0c;检验是否成功。 (5) 创建AccessKey 三、Java项目集成OSS 1. 导入依赖 2. Result.java代码&#xff1a; …...

mybatis-plus超详细讲解

mybatis-plus &#xff08;简化代码神器&#xff09; 地址&#xff1a;https://mp.baomidou.com/ 目录 mybatis-plus 简介 特性 支持数据库 参与贡献 快速指南 1、创建数据库 mybatis_plus 2、导入相关的依赖 3、创建对应的文件夹 4、编写配置文件 5、编写代码 …...

【Linux】--- 进程的概念

【Linux】--- 进程的概念 一、进程概念二、PCB1.什么是PCB2.什么是task_struct&#xff08;重点&#xff01;&#xff09;3.task_struct包含内容 三、task_struct内容详解1.查看进程&#xff08;1&#xff09;通过系统目录查看&#xff08;2&#xff09;通过ps命令查看&#xf…...

Unity NTPComponent应用, 实现一个无后端高效获取网络时间的组件

无后端高效获取网络时间的组件 废话不多说&#xff0c;直接上源码m_NowSerivceTime 一个基于你发行游戏地区的时间偏移&#xff0c; 比如北京时区就是 8, 巴西就是-3&#xff0c;美国就是-5using Newtonsoft.Json; 如果这里报错&#xff0c; 就说明项目没有 NewtonsoftJson插件…...

go语言使用zlib压缩[]byte

在Go语言中&#xff0c;可以使用compress/flate和compress/zlib包来实现对[]byte数据的Zlib压缩。下面是一个简单的示例&#xff0c;展示如何使用这些包来压缩一个字节切片&#xff1a; go package main import ( "bytes" "compress/zlib" "fmt"…...

Windows 配置 Tomcat环境

Windows配置Tomcat 1. 介绍 Tomcat是一个开源的、轻量级的Java应用服务器&#xff0c;在Java Web开发领域应用广泛。以下是关于它的详细介绍&#xff1a; 一、基本概念与背景 定义&#xff1a;Tomcat是Apache软件基金会&#xff08;Apache Software Foundation&#xff09;下…...

C++初阶-list的底层

目录 1.std::list实现的所有代码 2.list的简单介绍 2.1实现list的类 2.2_list_iterator的实现 2.2.1_list_iterator实现的原因和好处 2.2.2_list_iterator实现 2.3_list_node的实现 2.3.1. 避免递归的模板依赖 2.3.2. 内存布局一致性 2.3.3. 类型安全的替代方案 2.3.…...

突破不可导策略的训练难题:零阶优化与强化学习的深度嵌合

强化学习&#xff08;Reinforcement Learning, RL&#xff09;是工业领域智能控制的重要方法。它的基本原理是将最优控制问题建模为马尔可夫决策过程&#xff0c;然后使用强化学习的Actor-Critic机制&#xff08;中文译作“知行互动”机制&#xff09;&#xff0c;逐步迭代求解…...

Linux相关概念和易错知识点(42)(TCP的连接管理、可靠性、面临复杂网络的处理)

目录 1.TCP的连接管理机制&#xff08;1&#xff09;三次握手①握手过程②对握手过程的理解 &#xff08;2&#xff09;四次挥手&#xff08;3&#xff09;握手和挥手的触发&#xff08;4&#xff09;状态切换①挥手过程中状态的切换②握手过程中状态的切换 2.TCP的可靠性&…...

ardupilot 开发环境eclipse 中import 缺少C++

目录 文章目录 目录摘要1.修复过程摘要 本节主要解决ardupilot 开发环境eclipse 中import 缺少C++,无法导入ardupilot代码,会引起查看不方便的问题。如下图所示 1.修复过程 0.安装ubuntu 软件中自带的eclipse 1.打开eclipse—Help—install new software 2.在 Work with中…...

【JavaSE】绘图与事件入门学习笔记

-Java绘图坐标体系 坐标体系-介绍 坐标原点位于左上角&#xff0c;以像素为单位。 在Java坐标系中,第一个是x坐标,表示当前位置为水平方向&#xff0c;距离坐标原点x个像素;第二个是y坐标&#xff0c;表示当前位置为垂直方向&#xff0c;距离坐标原点y个像素。 坐标体系-像素 …...

有限自动机到正规文法转换器v1.0

1 项目简介 这是一个功能强大的有限自动机&#xff08;Finite Automaton, FA&#xff09;到正规文法&#xff08;Regular Grammar&#xff09;转换器&#xff0c;它配备了一个直观且完整的图形用户界面&#xff0c;使用户能够轻松地进行操作和观察。该程序基于编译原理中的经典…...

Pinocchio 库详解及其在足式机器人上的应用

Pinocchio 库详解及其在足式机器人上的应用 Pinocchio (Pinocchio is not only a nose) 是一个开源的 C 库&#xff0c;专门用于快速计算机器人模型的正向运动学、逆向运动学、雅可比矩阵、动力学和动力学导数。它主要关注效率和准确性&#xff0c;并提供了一个通用的框架&…...

Linux 中如何提取压缩文件 ?

Linux 是一种流行的开源操作系统&#xff0c;它提供了许多工具来管理、压缩和解压缩文件。压缩文件有助于节省存储空间&#xff0c;使数据传输更快。本指南将向您展示如何在 Linux 中提取不同类型的压缩文件。 1. Unpacking ZIP Files ZIP 文件是非常常见的&#xff0c;要在 …...

【UE5 C++】通过文件对话框获取选择文件的路径

目录 效果 步骤 源码 效果 步骤 1. 在“xxx.Build.cs”中添加需要使用的模块 &#xff0c;这里主要使用“DesktopPlatform”模块 2. 添加后闭UE编辑器&#xff0c;右键点击 .uproject 文件&#xff0c;选择 "Generate Visual Studio project files"&#xff0c;重…...

2025年- H71-Lc179--39.组合总和(回溯,组合)--Java版

1.题目描述 2.思路 当前的元素可以重复使用。 &#xff08;1&#xff09;确定回溯算法函数的参数和返回值&#xff08;一般是void类型&#xff09; &#xff08;2&#xff09;因为是用递归实现的&#xff0c;所以我们要确定终止条件 &#xff08;3&#xff09;单层搜索逻辑 二…...