当前位置:网站首页>【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 wechat applet monitoring network
- The longest ascending subsequence model acwing 1017 Strange thief Kidd's glider
- OpenGL三维图形绘制
- Greenplum6.x搭建_安装
- 详解华为应用市场2022年逐步减少32位包体上架应用和策略
- Greenplum 6.x common statements
- Test pits - what test points should be paid attention to when adding fields to existing interfaces (or database tables)?
- LeetCode 715. Range 模块
- 如何在图片的目标中添加目标的mask
- leetcode134. gas station
猜你喜欢

Explain Huawei's application market in detail, and gradually reduce 32-bit package applications and strategies in 2022

Simple use of Xray

JS operation

Compilation and linking of programs

Quick sorting (detailed illustration of single way, double way, three way)

Greenplum6.x常用语句

Nanjing commercial housing sales enabled electronic contracts, and Junzi sign assisted in the online signing and filing of housing transactions

Category of IP address

【踩坑】nacos注册一直连接localhost:8848,no available server

Markdown editor Use of MD plug-in
随机推荐
Analysis of abnormal channel number information before and after AGC re signature service
Required String parameter ‘XXX‘ is not present
Gson转换实体类为json时报declares multiple JSON fields named
数字三角形模型 AcWing 275. 传纸条
leetcode135. Distribute candy
How to add a mask of a target in a picture
Explain Huawei's application market in detail, and gradually reduce 32-bit package applications and strategies in 2022
更改当前文件夹及文件夹下文件日期shell脚本
【踩坑】nacos注册一直连接localhost:8848,no available server
[Yugong series] February 2022 U3D full stack class 006 unity toolbar
Greenplum6.x监控软件搭建
Several methods of calculating the average value of two numbers
NCS Chengdu Xindian interview experience
路由信息协议——RIP
模拟卷Leetcode【普通】1609. 奇偶树
2022-07-06 Unity核心9——3D动画
FPGA knowledge accumulation [6]
Problems encountered in the use of go micro
Sign and authenticate API interface or H5 interface
LeetCode 736. Lisp 语法解析