【发布时间】:2019-06-19 11:22:43
【问题描述】:
我有一个两节点 Kubernetes 集群,即一个主节点和两个工作节点。出于监控目的,我部署了 Prometheus 和 Grafana。现在,我想根据 CPU 使用情况自动缩放 pod。但是即使在配置了 Grafana 和 Prometheus 之后,我仍然收到以下错误 ---
Name: php-apache
Namespace: default
Labels: <none>
Annotations: <none>
CreationTimestamp: Mon, 17 Jun 2019 12:33:01 +0530
Reference: Deployment/php-apache
Metrics: ( current / target )
resource cpu on pods (as a percentage of request): <unknown> / 50%
Min replicas: 1
Max replicas: 10
Deployment pods: 1 current / 0 desired
Conditions:
Type Status Reason Message
---- ------ ------ -------
AbleToScale True SucceededGetScale the HPA controller was able to get the target's current scale
ScalingActive False FailedGetResourceMetric the HPA was unable to compute the replica count: unable to get metrics for resource cpu: unable to fetch metrics from resource metrics API: the server could not find the requested resource (get pods.metrics.k8s.io)
Events:
Type Reason Age From Message
---- ------ ---- ---- -------
Warning FailedGetResourceMetric 112s (x12408 over 2d4h) horizontal-pod-autoscaler unable to get metrics for resource cpu: unable to fetch metrics from resource metrics API: the server could not find the requested resource (get pods.metrics.k8s.io)
谁能告诉我为什么 Kubernetes 不从 Prometheus 获取指标?
【问题讨论】:
标签: kubernetes grafana prometheus