I have a spring boot application which is running in a Kubernete cluster successfully. But now I want to scale the application when we receive more traffic. So what are the metrics that I should consider if I am using Prometheus/Grafana combination in my application? The prometheus gives me lots of metrics, but I am a bit confused about which one should I use for HPA (Horizontal Pod scaling).
Also, you should install the metric server https://github.com/kubernetes-sigs/metrics-server before creating HPA
You should be using cpu or memory usage. say, if the usage goes above 80% scale the pods
sample based on cpu utilization
apiVersion: autoscaling/v1
kind: HorizontalPodAutoscaler
metadata:
name: php-apache
namespace: default
spec:
scaleTargetRef:
apiVersion: apps/v1
kind: Deployment
name: php-apache
minReplicas: 1
maxReplicas: 10
targetCPUUtilizationPercentage: 50