简体   繁体   English

HPA(水平 pod 自动缩放器)`currentCPUUtilizationPercentage` 的 Kube.netes Prometheus 指标?

[英]Kubernetes Prometheus metric for HPA (horizontal pod autoscaler) `currentCPUUtilizationPercentage`?

On a Kube.netes cluster with CoreOS Prometheus Operator scraping all standard cluster metrics, what Prometheus metric would show me the currentCPUUtilizationPercentage value for a simple HPA (horizontal pod autoscaler)?在使用 CoreOS Prometheus Operator 抓取所有标准集群指标的 Kube.netes 集群上,什么 Prometheus 指标会显示简单 HPA(水平 pod 自动缩放器)的currentCPUUtilizationPercentage值?

If I setup a simple hpa like:如果我设置一个简单的 hpa,例如:

$ kubectl autoscale deployment php-apache --cpu-percent=30 --min=3 --max=10

And then if I do kubectl get hpa php-apache -o yaml I see something like:然后如果我执行kubectl get hpa php-apache -o yaml我会看到类似这样的内容:

spec:
  maxReplicas: 10
  minReplicas: 3
  targetCPUUtilizationPercentage: 30
  ...
status:
  currentCPUUtilizationPercentage: 28
  currentReplicas: 9
  desiredReplicas: 9
  ...

I want to see that currentCPUUtilizationPercentage in Prometheus.我想在 Prometheus 中查看currentCPUUtilizationPercentage I've done a bunch of Prometheus queries to look for this.我做了一堆普罗米修斯查询来寻找这个。

I've searched all metrics tagged {hpa="php-apache"} and I see many hpa metrics, but not the metric I'm looking or.我搜索了所有标记{hpa="php-apache"}的指标,我看到了许多 hpa 指标,但没有看到我正在寻找的指标。 I can see kube_hpa_spec_target_metric set to 30 and I can see current status metrics like kube_hpa_status_condition but not the current cpu metric value that I want to see.我可以看到kube_hpa_spec_target_metric设置为 30,我可以看到当前状态指标,如kube_hpa_status_condition ,但看不到我想看到的当前 cpu 指标值。

I've searched all metrics tagged {metric_name="cpu"} and only see kube_hpa_spec_target_metric我搜索了所有标记{metric_name="cpu"}的指标,但只看到kube_hpa_spec_target_metric

I've searched all container and pod related metrics tagged {container="my-container-name"} and {pod=~"my-pod-prefix.*"} and I see several cpu related metrics like container_cpu_usage_seconds_total abnd container_spec_cpu_quota but nothing similar to or nothing that seems to be able to be used in calculating the currentCPUUtilizationPercentage value that I'm looking for?我搜索了所有标记{container="my-container-name"}{pod=~"my-pod-prefix.*"}容器和 pod 相关指标,我看到了几个与 cpu 相关的指标,例如container_cpu_usage_seconds_total abnd container_spec_cpu_quota但什么也没有类似于或似乎无法用于计算我正在寻找的currentCPUUtilizationPercentage值?

FYI, this is on Kube.netes 1.17.x and using a recent version of CoreOS Prometheus Operator.仅供参考,这是在 Kube.netes 1.17.x 上使用的最新版本的 CoreOS Prometheus Operator。

If I remember correctly currentCPUUtilizationPercentage is a k8 internal metrics for HPA and not exposed directly as a metrics you can scrape with Prometheus.如果我没记错的话,currentCPUUtilizationPercentage 是 HPA 的 k8 内部指标,不会直接公开为可以使用 Prometheus抓取的指标。 see https://github.com/kube.netes/community/blob/master/contributors/design-proposals/autoscaling/horizontal-pod-autoscaler.md#autoscaling-algorithm参见https://github.com/kube.netes/community/blob/master/contributors/design-proposals/autoscaling/horizontal-pod-autoscaler.md#autoscaling-algorithm

you probably could scrape component of currentCPUUtilizationPercentage metrics and create custom metrics to see it in Prometheus.您可能可以抓取currentCPUUtilizationPercentage 指标的组件并创建自定义指标以在 Prometheus 中查看它。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Kubernetes 水平 Pod 自动缩放器 (HPA) 测试 - Kubernetes Horizontal Pod Autoscaler (HPA) Testing 部署HPA(Horizo​​ntal Pod Autoscaler)的自定义指标(http请求)? - Deploy HPA (Horizontal Pod Autoscaler) based custom metric (http request)? Google Kube.netes Engine (GKE) 上的 Horizontal Pod Autoscaler (HPA) 通过 Stackdriver 外部指标使用 Ingress LoadBalancer 的后端延迟 - Horizontal Pod Autoscaler (HPA) on Google Kubernetes Engine (GKE) using Backend Latency from an Ingress LoadBalancer via Stackdriver External Metric 使用 Prometheus Adapter 的 Horizo​​ntal Pod Autoscaler (HPA) 自定义指标(如何定义单位?) - Horizontal Pod Autoscaler (HPA) custom metrics with Prometheus Adapter (How are units defined?) 难以使用外部指标配置 Horizo​​ntal Pod Autoscaler - Difficulty configuring Horizontal Pod Autoscaler with external metric Horizo​​ntal Pod Autoscaler (HPA):当前利用率:<unknown> 使用自定义命名空间 - Horizontal Pod Autoscaler (HPA): Current utilization: <unknown> with custom namespace Prometheus是否如Kubernetes仪表板所示公开了Horizo​​ntal Pod Autoscaler的“当前CPU使用率”? - Does Prometheus expose the Horizontal Pod Autoscaler's “Current CPU Utilization” as shown in the Kubernetes dashboard? Horizontal Pod Autoscaler:HPA 的确切值是多少? - Horizontal Pod Autoscaler: which the exact value does HPA take? 使用ArangoDB Kubernetes运算符的水平Pod自动缩放器 - Horizontal Pod Autoscaler with the ArangoDB Kubernetes Operator Kube.netes Horizontal Pod Autoscaler 因意外的 GroupVersion 而失败 - Kubernetes Horizontal Pod Autoscaler fails with unexpected GroupVersion
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM