I have deployed a HPA the configuration showed at the bottom. It scales up when either CPU or Memory usage is above 75%. The initial replicas count is 1 and the max is 3. But I can see the pod count was scaled up to 3 1 few minutes after I deploy the HPA.
The current usage of CPU/Memory is shown below. You can see it is quit low compare the requested resources which is 2 CPU and 8GB memory. I don't understand why it scales. Did I make any mistake on the configuration?
$ kubectl top pod transform-67df4445c5-6qpdd
W0818 16:04:43.199730 63930 top_pod.go:140] Using json format to get metrics. Next release will switch to protocol-buffers, switch early by passing --use-protocol-buffers flag
NAME CPU(cores) MEMORY(bytes)
transform-67df4445c5-6qpdd 250m 495Mi
apiVersion: apps/v1
kind: Deployment
metadata:
name: transform
namespace: default
spec:
replicas: 1
selector:
matchLabels:
name: transform
template:
metadata:
labels:
name: transform
spec:
containers:
- name: transform
image: zhaoyi0113/es-kinesis-firehose-transform
resources:
requests:
cpu: 2
memory: 8
ports:
- containerPort: 8080
---
apiVersion: autoscaling/v2beta2
kind: HorizontalPodAutoscaler
metadata:
name: transform
spec:
scaleTargetRef:
apiVersion: apps/v1
kind: Deployment
name: transform
minReplicas: 1
maxReplicas: 3
metrics:
- type: Resource
resource:
name: cpu
target:
type: Utilization
averageUtilization: 75
- type: Resource
resource:
name: memory
target:
type: Utilization
averageUtilization: 75