当前位置:网站首页>【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
边栏推荐
- PPT模板、素材下载网站(纯干货,建议收藏)
- [MySQL] detailed explanation of trigger content of database advanced
- 【MySQL】数据库进阶之触发器内容详解
- C language for calculating the product of two matrices
- Markdown editor Use of MD plug-in
- Routing information protocol rip
- JS operation
- NCS Chengdu Xindian interview experience
- Golang etcdv3 reports an error. The attribute in grpc does not exist
- 数据分析方法论与前人经验总结2【笔记干货】
猜你喜欢
随机推荐
9c09730c0eea36d495c3ff6efe3708d8
Frequently Asked Coding Problems
Greenplum 6.x version change record common manual
channel. Detailed explanation of queuedeclare parameters
如何在快应用中实现滑动操作组件
Novice entry SCM must understand those things
硬件大熊原创合集(2022/06更新)
Tronapi wave field interface - source code without encryption - can be opened twice - interface document attached - package based on thinkphp5 - detailed guidance of the author - July 6, 2022 - Novice
Implement custom memory allocator
Selenium automation integration, eight years of testing experience, soft test engineer, an article to teach you
Unity Shader入门精要初级篇(一)-- 基础光照笔记
OpenGL帧缓冲
About using CDN based on Kangle and EP panel
Compilation and linking of programs
Several methods of calculating the average value of two numbers
MySQL主从延迟的解决方案
cmake命令行使用
Three series of BOM elements
leetcode134. gas station
JS的操作









![[Yugong series] February 2022 U3D full stack class 005 unity engine view](/img/19/dc1b2f74b9ec5f5808de3049793862.jpg)