距离上一次更新该文章已经过了 749 天,文章所描述的內容可能已经发生变化,请留意。
Alertmanager重复/缺失告警现象探究及两个关键参数group_wait和group_interval的释义
K8s about pod resource monitoring(记录些常用的Prometheus规则expr)
最近5分钟,pod 磁盘io利用/写, 大于100的
plaintext
1 | sum(rate(container_fs_writes_bytes_total{pod!=""}[5m])) by (pod,namespace,instance) > 100 |
最近30分钟pod重启
plaintext
1 | changes(kube_pod_container_status_restarts_total[30m])>0 |
Ready状态(配合for参数, 比如for=5m, Ready持续5分钟,说明启动有问题
)
plaintext
1 | kube_pod_container_status_ready != 1 |
pod运行状态
plaintext
1 | kube_pod_container_status_running != 1 |
the containers readiness check succeeded(过去5分钟)
plaintext
1 | min_over_time(kube_pod_container_status_ready{pod!~".*helm.*"}[5m]) == 0 |
Pod的状态为未运行
plaintext
1 | sum (kube_pod_status_phase{phase!="Running"}) by (namespace,pod,phase) |
内存使用率过高, 大于70%
plaintext
1 | (node_memory_MemTotal_bytes - (node_memory_MemFree_bytes + node_memory_Buffers_bytes + node_memory_Cached_bytes)) / node_memory_MemTotal_bytes * 100 > 70 |
cpu使用率过高, 大于70%
plaintext
1 | 100 * (1 - avg(irate(node_cpu_seconds_total{mode="idle"}[5m])) by(instance)) > 70 |
磁盘使用率过高, 大于70%
bash
1 | 100 * (node_filesystem_size_bytes{fstype=~"xfs|ext4"} - node_filesystem_avail_bytes) / node_filesystem_size_bytes > 70 |
Number of conntrack are getting close to the limit(最大连接追踪数接近上限)
参考:
https://deploy.live/blog/kubernetes-networking-problems-due-to-the-conntrack/
通过(node_nf_conntrack_entries / on (pod) node_nf_conntrack_entries_limit / on (pod) group_right kube_pod_info) > 0.75
查看, 如果利用rancher安装, 默认警告值为75%

通过node_nf_conntrack_entries_limit
查看各节点的上限数, 8核默认为262144, 4核默认为其一半

可参考nf_conntrack:table full 引发的问题进行修改
方法之一: 修改参数
bash
1 | vim /etc/sysctl.conf |
增加完以上内容后,通过sysctl -p 使配置生效 。不过该方法缺点:一是重启iptables后,ip_conntrack_max值又会变成默认值,需要重新sysctl -p
本博客所有文章除特别声明外,均采用 CC BY-NC-SA 4.0 许可协议。转载请注明来源 小五的个人杂货铺!