我应该使用哪些指标来扩展与Prometheus和Kubernetes集成的微服务应用程序?

时间:2019-11-19 10:27:28

标签: spring-boot kubernetes prometheus spring-boot-actuator

我有一个Spring Boot应用程序,该应用程序已在Kubernete集群中成功运行。但是现在我想在我们收到更多流量时扩展应用程序。那么,如果我在应用程序中使用Prometheus / Grafana组合,应该考虑哪些指标?普罗米修斯给了我很多指标,但是我对于应该使用哪种指标进行HPA(水平Pod缩放)感到有些困惑。

2 个答案:

答案 0 :(得分:1)

您应该使用cpu或内存使用情况。例如,如果使用量超过了80%,则豆荚的比例会升高

基于cpu利用率的样本

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

答案 1 :(得分:1)

此外,您应该在创建HPA之前安装度量服务器https://github.com/kubernetes-sigs/metrics-server

相关问题