当前位置:网站首页>【ChaosBlade:节点磁盘填充、杀节点上指定进程、挂起节点上指定进程】
【ChaosBlade:节点磁盘填充、杀节点上指定进程、挂起节点上指定进程】
2022-07-07 06:20:00 【仙女肖消乐】
节点磁盘填充场景
目标: 指定节点磁盘占用 80%
选择一个节点,修改 fill_node_disk_by_names.yaml 中的 names 值。
ill_node_disk_by_names.yaml 内容:
apiVersion: chaosblade.io/v1alpha1
kind: ChaosBlade
metadata:
name: fill-node-disk-by-names
spec:
experiments:
- scope: node
target: disk
action: fill
desc: "node disk fill"
matchers:
- name: names
value: ["docker20"]
- name: percent
value: ["80"]
执行命令,开始实验:
$ kubectl apply -f fill_node_disk_by_names.yaml
查看实验状态
执行 kubectl get blade fill-node-disk-by-names -o json 命令,查看实验状态。
查看实验结果
可以看到磁盘占用 80%。
# 进入实验 node
$ ssh [email protected]
# 查看磁盘使用率
$ df -h
Filesystem Size Used Avail Use% Mounted on
udev 7.9G 0 7.9G 0% /dev
tmpfs 1.6G 2.2M 1.6G 1% /run
/dev/sda2 98G 73G 20G 79% /
tmpfs 7.9G 0 7.9G 0% /dev/shm
tmpfs 5.0M 0 5.0M 0% /run/lock
tmpfs 7.9G 0 7.9G 0% /sys/fs/cgroup
/dev/loop1 90M 90M 0 100% /snap/core/8268
tmpfs 1.6G 0 1.6G 0% /run/user/1000
/dev/loop0 98M 98M 0 100% /snap/core/9289
停止实验
执行命令:kubectl delete -f fill_node_disk_by_names.yaml
或者直接删除 blade 资源:kubectl delete blade fill-node-disk-by-names
节点进程相关场景
目标: 此实验会删除指定节点上的 redis-server 进程。
选择一个节点,修改 kill_node_process_by_names.yaml 中的 names 值。
kill_node_process_by_names.yaml 内容:
apiVersion: chaosblade.io/v1alpha1
kind: ChaosBlade
metadata:
name: kill-node-process-by-names
spec:
experiments:
- scope: node
target: process
action: kill
desc: "kill node process by names"
matchers:
- name: names
value: ["docker20"]
- name: process
value: ["redis-server"]
执行命令,开始实验:
$ kubectl apply -f kill_node_process_by_names.yaml
查看实验状态
执行 kubectl get blade kill-node-process-by-names -o json 命令,查看实验状态。
查看实验结果
# 进入实验 node
$ ssh [email protected]
# 查看 redis-server 进程号
$ ps -ef | grep redis-server
root 31327 31326 0 06:15 ? 00:00:00 redis-server *:6379
# 可以看到进程号发生了变化
$ ps -ef | grep redis-server
root 2873 2872 0 06:23 ? 00:00:00 redis-server *:6379
redis-server 的进程号发生改变,说明被杀掉后,又被重新拉起。
停止实验
执行命令:kubectl delete -f kill_node_process_by_names.yaml
或者直接删除 blade 资源:kubectl delete blade kill-node-process-by-names
挂起节点上指定进程
目标: 此实验会挂起指定节点上的 redis-server 进程。
选择一个节点,修改 stop_node_process_by_names.yaml 中的 names 值。
stop_node_process_by_names.yaml 内容:
apiVersion: chaosblade.io/v1alpha1
kind: ChaosBlade
metadata:
name: stop-node-process-by-names
spec:
experiments:
- scope: node
target: process
action: stop
desc: "kill node process by names"
matchers:
- name: names
value: ["docker20"]
- name: process
value: ["redis-server"]
执行命令,开始实验:
$ kubectl apply -f stop_node_process_by_names.yaml
查看实验状态
执行 kubectl get blade stop-node-process-by-names -o json 命令,查看实验状态。
查看实验结果
# 进入实验 node
$ ssh [email protected]
# 查看 redis-server 进程号
$ ps aux| grep redis-server
root 5632 0.0 0.0 41520 4168 ? Tl 06:28 0:06 redis-server *:6379
可以看到 redis-server 此刻进程处于暂停状态了(T)。
停止实验
执行命令:kubectl delete -f stop_node_process_by_names.yaml
或者直接删除 blade 资源:kubectl delete blade stop-node-process-by-names
边栏推荐
- uniapp 微信小程序监测网络
- How to add a mask of a target in a picture
- Several methods of calculating the average value of two numbers
- 9c09730c0eea36d495c3ff6efe3708d8
- JS operation
- PPT模板、素材下载网站(纯干货,建议收藏)
- Enterprise manager cannot connect to the database instance
- ESP32-ULP协处理器低功耗模式RTC GPIO中断唤醒
- Markdown editor Use of MD plug-in
- [Yugong series] February 2022 U3D full stack class 006 unity toolbar
猜你喜欢
Greenplum6.x常用语句
Novice entry SCM must understand those things
Count sort (diagram)
MySQL主从延迟的解决方案
Output a spiral matrix C language
NCS Chengdu Xindian interview experience
使用Typora编辑markdown上传CSDN时图片大小调整麻烦问题
Nanjing commercial housing sales enabled electronic contracts, and Junzi sign assisted in the online signing and filing of housing transactions
Category of IP address
[Yugong series] February 2022 U3D full stack class 007 - production and setting skybox resources
随机推荐
opencv之图像分割
Mock. JS usage details
[Yugong series] February 2022 U3D full stack class 007 - production and setting skybox resources
Compilation and linking of programs
Mountaineering team (DFS)
Markdown editor Use of MD plug-in
测试踩坑 - 当已有接口(或数据库表中)新增字段时,都需要注意哪些测试点?
年薪50w阿裏P8親自下場,教你如何從測試進階
Gson converts the entity class to JSON times declare multiple JSON fields named
[Yugong series] February 2022 U3D full stack class 006 unity toolbar
使用Typora编辑markdown上传CSDN时图片大小调整麻烦问题
最长上升子序列模型 AcWing 1017. 怪盗基德的滑翔翼
Required String parameter ‘XXX‘ is not present
Frequently Asked Coding Problems
A bug using module project in idea
Speaking of a software entrepreneurship project, is there anyone willing to invest?
Find the original code, inverse code and complement of signed numbers [C language]
OpenGL三维图形绘制
Greenplum 6.x build_ Environment configuration
2022-07-06 Unity核心9——3D动画