【发布时间】:2019-09-07 13:12:59
【问题描述】:
我已将 Prometheus-adapter 配置为从 Prometheus 获取自定义指标。
当我执行命令时:
kubectl get --raw /apis/custom.metrics.k8s.io/v1beta1
结果如下。
{
"name": "namespaces/envoy_http_ingress_http_downstream_cx_http1",
"singularName": "",
"namespaced": false,
"kind": "MetricValueList",
"verbs": [
"get"
]
},
{
"name": "namespaces/envoy_cluster_xds_cluster_upstream_cx_rx_bytes",
"singularName": "",
"namespaced": false,
"kind": "MetricValueList",
"verbs": [
"get"
]
},
{
"name": "jobs.batch/statsd_exporter_lines",
"singularName": "",
"namespaced": true,
"kind": "MetricValueList",
"verbs": [
"get"
]
},
{
"name": "pods/fs_writes_merged",
"singularName": "",
"namespaced": true,
"kind": "MetricValueList",
"verbs": [
"get"
]
},
我的HPA配置如下:
apiVersion: autoscaling/v2beta1
kind: HorizontalPodAutoscaler
metadata:
name: scale
namespace: default
spec:
scaleTargetRef:
apiVersion: apps/v1
kind: Deployment
name: billing-app
minReplicas: 1
maxReplicas: 10
# targetCPUUtilizationPercentage: 50
metrics:
- type: External
external:
metricName: fs_writes_merged
targetValue: 100
Hpa 结果未知。不知道为什么它无法获取指标。
Hpa 必须能够读取自定义指标。
【问题讨论】:
-
你关注this guide了吗?
-
是的,我关注了。
-
如果您遵循上述指南,您应该在 HPA 定义中使用
type: Pod而不是type: External作为指标类型(在此下方,键是pods而不是external)。也许尝试改变它?
标签: kubernetes google-cloud-platform prometheus autoscaling