[英]Calculate the memory and CPU utilization for pods by Prometheus
I'm trying to find the sutiable expression to set alert that can calculate the Pods utlization that are reaching 80% for both memory and CPU on all the pods that are exisiting on namespace so i appreciate if can someone help me to achieve that我正在尝试找到合适的表达式来设置警报,该警报可以计算 memory 和 CPU 在命名空间上存在的所有 Pod 上达到 80% 的 Pod 利用率,所以如果有人可以帮助我实现这一目标,我将不胜感激
The Kubernetes ecosystem includes two complementary add-ons for aggregating and reporting valuable monitoring data from your cluster: Metrics Server and kube-state-metrics. Kubernetes 生态系统包括两个互补的附加组件,用于从集群聚合和报告有价值的监控数据:Metrics Server 和 kube-state-metrics。
Metrics Server collects resource usage statistics from the kubelet on each node and provides aggregated metrics through the Metrics API . Metrics Server从每个节点上的 kubelet 收集资源使用统计信息,并通过Metrics API提供聚合指标。 Metrics Server stores only near-real-time metrics in memory, so it is primarily valuable for spot checks of CPU or memory usage, or for periodic querying by a full-featured monitoring service that retains data over longer timespans. Metrics Server 仅在 memory 中存储近乎实时的指标,因此它主要用于 CPU 或 memory 使用情况的抽查,或通过功能齐全的监控服务进行定期查询,该服务在更长的时间跨度内保留数据。
kube-state-metrics is a service that makes cluster state information easily consumable. kube-state-metrics是一项使集群 state 信息易于使用的服务。 Whereas Metrics Server exposes metrics on resource usage by pods and nodes, kube-state-metrics listens to the Control Plane API server for data on the overall status of Kubernetes objects (nodes, pods, Deployments, etc.), as well as the resource limits and allocations for those objects. Metrics Server 公开有关 pod 和节点资源使用情况的指标,kube-state-metrics 监听控制平面 API 服务器以获取有关 Kubernetes 对象(节点、pod、部署等)以及资源的整体状态的数据这些对象的限制和分配。 It then generates metrics from that data that are available through the Metrics API.然后,它会根据该数据生成指标,这些数据可通过 Metrics API 获得。
Once you have installed the same, you can use the following command to get the metrics一旦你安装了相同的,你可以使用以下命令来获取指标
kubectl top pod <pod-name> -n <namespace> --containers
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.