rancher官方文档
一个不错的Prometheus中文网站
上面网站的一个备用地址
AlertManager 何时报警
Alertmanager重复/缺失告警现象探究及两个关键参数group_wait和group_interval的释义
Kubernetes集群监控指标项详解
K8s about pod resource monitoring(记录些常用的Prometheus规则expr)
最近5分钟,pod 磁盘io利用/写, 大于100的
1
| sum(rate(container_fs_writes_bytes_total{pod!=""}[5m])) by (pod,namespace,instance) > 100
|
最近30分钟pod重启
1
| changes(kube_pod_container_status_restarts_total[30m])>0
|
Ready状态(配合for参数, 比如for=5m, Ready持续5分钟,说明启动有问题)
1
| kube_pod_container_status_ready != 1
|
pod运行状态
1
| kube_pod_container_status_running != 1
|
the containers readiness check succeeded(过去5分钟)
1
| min_over_time(kube_pod_container_status_ready{pod!~".*helm.*"}[5m]) == 0
|
Pod的状态为未运行
1
| sum (kube_pod_status_phase{phase!="Running"}) by (namespace,pod,phase)
|
内存使用率过高, 大于70%
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%
1
| 100 * (1 - avg(irate(node_cpu_seconds_total{mode="idle"}[5m])) by(instance)) > 70
|
磁盘使用率过高, 大于70%
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 引发的问题进行修改
方法之一: 修改参数
1 2 3 4 5 6 7 8 9
| vim /etc/sysctl.conf
net.ipv4.ip_conntrack_max = 393216 net.ipv4.netfilter.ip_conntrack_max = 393216
net.ipv4.netfilter.ip_conntrack_tcp_timeout_established = 300 net.ipv4.netfilter.ip_conntrack_tcp_timeout_time_wait = 120 net.ipv4.netfilter.ip_conntrack_tcp_timeout_close_wait = 60 net.ipv4.netfilter.ip_conntrack_tcp_timeout_fin_wait = 120
|
增加完以上内容后,通过sysctl -p 使配置生效 。不过该方法缺点:一是重启iptables后,ip_conntrack_max值又会变成默认值,需要重新sysctl -p