我的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
在上面的yaml文件中,我使用了两个资源,如下所示
metrics:
- type: Resource
resource:
name: cpu
target:
type: Utilization
averageUtilization: 70
- type: Resource
resource:
name: memory
target:
type: AverageValue
averageValue: 100Mi
应用程序没有很快释放内存资源,一旦我删除了内存资源,当利用率较低时,pod就会缩小。