当前位置:网站首页>【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
边栏推荐
- Greenplum6.x重新初始化
- LeetCode 736. LISP syntax parsing
- Greenplum 6.x reinitialization
- Several methods of calculating the average value of two numbers
- 年薪50w阿里P8亲自下场,教你如何从测试进阶
- Simple use of Xray
- Mock.js用法详解
- Markdown编辑器Editor.md插件的使用
- Shell script for changing the current folder and the file date under the folder
- Vagrant failed to mount directory mount: unknown filesystem type 'vboxsf'
猜你喜欢
[MySQL] detailed explanation of trigger content of database advanced
Platformization, a fulcrum of strong chain complementing chain
LeetCode 715. Range module
Quick sorting (detailed illustration of single way, double way, three way)
LeetCode 736. LISP syntax parsing
Three series of BOM elements
南京商品房买卖启用电子合同,君子签助力房屋交易在线网签备案
Rapid integration of authentication services - harmonyos platform
Greenplum6.x-版本变化记录-常用手册
Mountaineering team (DFS)
随机推荐
Output all composite numbers between 6 and 1000
MySQL主从延迟的解决方案
Count sort (diagram)
JS operation
Explain Huawei's application market in detail, and gradually reduce 32-bit package applications and strategies in 2022
南京商品房买卖启用电子合同,君子签助力房屋交易在线网签备案
Digital triangle model acwing 275 Pass a note
ESP32-ULP协处理器低功耗模式RTC GPIO中断唤醒
Newly found yii2 excel processing plug-in
Greenplum 6.x version change record common manual
Gson converts the entity class to JSON times declare multiple JSON fields named
详解华为应用市场2022年逐步减少32位包体上架应用和策略
模拟卷Leetcode【普通】1706. 球会落何处
【微信小程序:缓存操作】
[Yugong series] February 2022 U3D full stack class 008 - build a galaxy scene
Digital triangle model acwing 1027 Grid access
oracle一次性说清楚,多种分隔符的一个字段拆分多行,再多行多列多种分隔符拆多行,最终处理超亿亿。。亿级别数据量
redis故障处理 “Can‘t save in background: fork: Cannot allocate memory“
[Nanjing University] - [software analysis] course learning notes (I) -introduction
How to add a mask of a target in a picture