首页 > 解决方案 > Kubernetes 集群的自定义指标 API 服务安装

问题描述

我们计划使用 Kubernetes 水平 pod 调度程序,为此需要安装自定义指标 API。有人可以告诉在 kubernetes 集群上安装自定义指标 API 的不同方法吗?

标签: kubernetesterraformprometheusamazon-eks

解决方案


当您将 EKS 与Prometheus一起使用时,最好的知识来源是 AWS 文档。

我需要普罗米修斯适配器来注册自定义指标 API 吗?

Prometheus是的,您至少需要Prometheus Adapter

  • Prometheus:抓取 pod 并存储指标
  • Prometheus metrics adapter:查询Prometheus和公开 Kubernetes 自定义指标 API 的指标
  • Metrics server:收集 pod CPU 和内存使用情况并公开 Kubernetes 资源指标 API 的指标

如果没有Custom Metricsor External Metrics,您只能使用基于CPUor的指标Memory

Autoscaling Amazon EKS services based on custom Prometheus metrics using CloudWatch Container Insights一文中指出:

Prometheus 收集的自定义指标可以使用标题为在 Fargate 上使用自定义指标自动缩放 EKSPrometheus Adapter的博客文章中概述的方法向自动缩放器公开。

Autoscaling EKS on Fargate with custom metrics博客中,您还可以找到一些示例autoscaling based on CPU usageautoscaling based on App Mesh trafficautoscaling based on HTTP traffic

附加文件


推荐阅读