Which metrics should I use to scale a microservice application integrated with Prometheus and Kubernetes?

11/19/2019

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).

-- Anson
kubernetes
prometheus
spring-boot
spring-boot-actuator

2 Answers

11/19/2019

Also, you should install the metric server https://github.com/kubernetes-sigs/metrics-server before creating HPA

-- Volodymyr Davydenko
Source: StackOverflow

11/19/2019

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
-- P Ekambaram
Source: StackOverflow