1

我有这样的HPA。Pod 的扩展性很好,但没有缩小,CPU 利用率仅为 5%。它没有缩小到 1 个副本的最小值。

以下是我的 HPA

apiVersion: autoscaling/v2beta2
kind: HorizontalPodAutoscaler
metadata:
  name: app
spec:
  scaleTargetRef:
    apiVersion: apps/v1
    kind: Deployment
    name: app
  minReplicas: 1
  maxReplicas: 10
  metrics:
  - type: Resource
    resource:
      name: cpu
      target:
        type: Utilization
        averageUtilization: 70
  - type: Resource
    resource:
      name: memory
      target:
        type: AverageValue
        averageValue: 100Mi
4

1 回答 1

1

在上面的 yaml 文件中,我使用了两个资源,如下所示

metrics:
  - type: Resource
    resource:
      name: cpu
      target:
        type: Utilization
        averageUtilization: 70
  - type: Resource
    resource:
      name: memory
      target:
        type: AverageValue
        averageValue: 100Mi

内存资源并没有被应用程序快速释放,一旦我删除了内存资源,当利用率较低时,Pod 就会缩小。

于 2020-12-02T05:09:44.970 回答