Custom Metrics API service install for kubernetes cluster

11/19/2020

We are planning to Kubernetes horizontal pod scheduler and for that need to install Custom Metrics API. Can someone please tell different ways to install Custom Metrics API on kubernetes cluster?

-- Kumar
amazon-eks
kubernetes
prometheus
terraform

1 Answer

11/24/2020

As you are using EKS with Prometheus, the best source of knowledge is AWS documentation.

Do i need prometheus adaptor for registering custom metrics API?

Yes, you need at least Prometheus and Prometheus Adapter.

  • Prometheus: scrapes pods and stores metrics
  • Prometheus metrics adapter: queries Prometheus and exposes metrics for the Kubernetes custom metrics API
  • Metrics server: collects pods CPU and memory usage and exposes metrics for the Kubernetes resource metrics API

Without Custom Metrics or External Metrics, you can only use metrics based on CPU or Memory.

In Autoscaling Amazon EKS services based on custom Prometheus metrics using CloudWatch Container Insights article, it's stated:

The custom metrics gathered by Prometheus can be exposed to the autoscaler using a Prometheus Adapter as outlined in the blog post titled Autoscaling EKS on Fargate with custom metrics.

In Autoscaling EKS on Fargate with custom metrics blog you also find some examples of autoscaling based on CPU usage, autoscaling based on App Mesh traffic or autoscaling based on HTTP traffic

Additional documentation

-- PjoterS
Source: StackOverflow