使用ChaosMesh注入NetworkChaos 的Bandwidth 带宽限制故障时,配置的rate过小时,比如1bps,会导致类似于
Failed to apply chaos: failed to apply for pod cmc/client-5f4cd5d89-gcrz8: unable to set tcs for pod client-5f4cd5d89-gcrz8
的错误提示。
稍大比如1kbps就行了。
所以网络带宽限制有一个隐含的下限,ChaosMesh 通过UI创建故障时,并不会检查这个下限。
具体下限不详,用chaosctl输出1bps错误时调试信息是这样的:
[Chaos]: test-bandwidth
[Pod]: client-5f4cd5d89-pttfd
1. [ipset list]
Name: test-_2c7210c5b95_net_batgt
Type: hash:net
Revision: 6
Header: family inet hashsize 1024 maxelem 65536
Size in memory: 504
References: 2
Number of entries: 1
Members:
192.168.87.121
Name: test-_2c7210c_netport_batgt
Type: hash:net,port
Revision: 7
Header: family inet hashsize 1024 maxelem 65536
Size in memory: 456
References: 2
Number of entries: 0
Members:
Name: test-_2c7210c5b95_net_batgtold
Type: hash:net
Revision: 6
Header: family inet hashsize 1024 maxelem 65536
Size in memory: 504
References: 0
Number of entries: 1
Members:
192.168.87.121
Name: test-_2c7210c_netport_batgtold
Type: hash:net,port
Revision: 7
Header: family inet hashsize 1024 maxelem 65536
Size in memory: 456
References: 0
Number of entries: 0
Members:
Name: test-_2c7210c5b95_set_batgt
Type: list:set
Revision: 3
Header: size 8
Size in memory: 176
References: 0
Number of entries: 2
Members:
test-_2c7210c5b95_net_batgt
test-_2c7210c_netport_batgt
Name: test-_2c7210c5b95_set_batgtold
Type: list:set
Revision: 3
Header: size 8
Size in memory: 176
References: 0
Number of entries: 2
Members:
test-_2c7210c5b95_net_batgt
test-_2c7210c_netport_batgt
2. [tc qdisc list]
qdisc noqueue 0: dev lo root refcnt 2
qdisc prio 1: dev eth0 root refcnt 2 bands 4 priomap 1 2 2 2 1 2 0 0 1 1 1 1 1 1 1 1
qdisc sfq 2: dev eth0 parent 1:1 limit 127p quantum 1464b depth 127 divisor 1024
qdisc sfq 4: dev eth0 parent 1:3 limit 127p quantum 1464b depth 127 divisor 1024
qdisc sfq 3: dev eth0 parent 1:2 limit 127p quantum 1464b depth 127 divisor 1024
3. [iptables list]
Chain INPUT (policy ACCEPT)
target prot opt source destination
CHAOS-INPUT all -- anywhere anywhere
Chain FORWARD (policy ACCEPT)
target prot opt source destination
Chain OUTPUT (policy ACCEPT)
target prot opt source destination
CHAOS-OUTPUT all -- anywhere anywhere
Chain CHAOS-INPUT (1 references)
target prot opt source destination
Chain CHAOS-OUTPUT (1 references)
target prot opt source destination
4. [podnetworkchaos]
{
"ipsets": [
{
"name": "test-_2c7210c5b95_net_batgt",
"ipsetType": "hash:net",
"cidrs": [
"192.168.87.121/32"
],
"source": "cmc/test-bandwidth"
},
{
"name": "test-_2c7210c_netport_batgt",
"ipsetType": "hash:net,port",
"source": "cmc/test-bandwidth"
},
{
"name": "test-_2c7210c5b95_set_batgt",
"ipsetType": "list:set",
"setNames": [
"test-_2c7210c5b95_net_batgt",
"test-_2c7210c_netport_batgt"
],
"source": "cmc/test-bandwidth"
}
],
"tcs": [
{
"type": "bandwidth",
"bandwidth": {
"rate": "1bps",
"limit": 1,
"buffer": 1
},
"ipset": "test-_2c7210c5b95_set_batgt",
"source": "cmc/test-bandwidth"
}
]
}