I have a deployment that is supposed to scale between 5 and 20 pods. For the sake of simplicity, lets say that the pod requests 128Mi and has a limit of 512Mi, so I want the memory usage of the pod between 305Mi and 410Mi.
If the avarage memory usage is above 410Mi a new pod should go up. If the average memory usage is below 305Mi, one pod should be shutdown.
by using:
spec:
scaleTargetRef:
apiVersion: apps/v1
kind: Deployment
name: myDeployment
minReplicas: 5
maxReplicas: 20
metrics:
- type: Resource
resource:
name: cpu
target:
type: Utilization
averageUtilization: 50
#type: AvarageValue
#avarageValue: 305
#avarageValue: 410
and the problem is that im getting A LOT of flapping:
- a new pod goes up,
- avg load drops below “target value”,
- pod gets removed,
- avg load goes above “target value”,
- new pod provisioned,
- and it keeps flapping all day long until about 1am when service utilization drops
1