内存使用
container_memory_working_set_bytes{container=“api-gateway”}/1024/1024

备注:Kubernetes Memory Limit看的实际上是 container_memory_working_set_byte

内存使用率大于 80%
方法一:
sum by(name, id, job, node) (container_memory_rss{image!=“”,job=“kubelet”}) / sum by(name, id, job, node) (container_spec_memory_limit_bytes{image!=“”,job=“kubelet”}) * 100 != +Inf > 80
方法二:
sum by(pod, namespace, job) (container_memory_usage_bytes{namespace=“default”}) / sum by(pod, namespace, job) (container_spec_memory_limit_bytes{namespace=“default”}) * 100 != +Inf > 80
方法三:
sum by(pod, namespace, job) (container_memory_working_set_bytes{image!=“”}) / sum by(pod, namespace, job) (container_spec_memory_limit_bytes{image!=“”}) * 100 != +Inf > 80

cpu使用率大于90%
sum by(pod, namespace, job) (rate(container_cpu_usage_seconds_total{image!=“”}[1m])) / (sum by(pod, namespace, job) (container_spec_cpu_quota{image!=“”} / 100000)) * 100 > 90

容器入带宽大于50M
sum by (namespace,job,pod) (irate(container_network_receive_bytes_total{image!=“”}[3m])) / 1024 /1024 > 50
容器出带宽大于50M
sum by (namespace,job,pod) (irate(container_network_transmit_bytes_total{image!=“”}[1m])) / 1024 /1024 > 50

Logo

K8S/Kubernetes社区为您提供最前沿的新闻资讯和知识内容

更多推荐