我正在使用 prometheus 和适配器来扩展 HPA(自定义指标 memory_usage_bytes)。我不知道为什么 m 附加了 targetValue 并且 HPA 在不使用内存时也不会缩小 pod。
我错过了什么吗?
HPA 代码
apiVersion: autoscaling/v2beta1
kind: HorizontalPodAutoscaler
metadata:
name: pros
namespace: default
spec:
scaleTargetRef:
apiVersion: apps/v1
kind: Deployment
name: pros
maxReplicas: 3
metrics:
- type: Pods
pods:
metricName: memory_usage_bytes
targetAverageValue: 33000000
kubectl 获取 hpa
NAME REFERENCE TARGETS MINPODS MAXPODS REPLICAS AGE
pros Deployment/pros 26781013333m/33M 1 3 3 19m
custom.metrics.k8.io
{
"kind": "MetricValueList",
"apiVersion": "custom.metrics.k8s.io/v1beta1",
"metadata": {
"selfLink": "/apis/custom.metrics.k8s.io/v1beta1/namespaces/default/pods/%2A/memory_usage_bytes"
},
"items": [
{
"describedObject": {
"kind": "Pod",
"namespace": "default",
"name": "pros-6c9b9c5c59-57vmx",
"apiVersion": "/v1"
},
"metricName": "memory_usage_bytes",
"timestamp": "2019-07-13T12:03:10Z",
"value": "34947072",
"selector": null
},
{
"describedObject": {
"kind": "Pod",
"namespace": "default",
"name": "pros-6c9b9c5c59-957zv",
"apiVersion": "/v1"
},
"metricName": "memory_usage_bytes",
"timestamp": "2019-07-13T12:03:10Z",
"value": "19591168",
"selector": null
},
{
"describedObject": {
"kind": "Pod",
"namespace": "default",
"name": "pros-6c9b9c5c59-nczqq",
"apiVersion": "/v1"
},
"metricName": "memory_usage_bytes",
"timestamp": "2019-07-13T12:03:10Z",
"value": "19615744",
"selector": null
}
]
}