Service Configuration
medium

Pregunta de Service Configuration #019e3a4f

Enunciado de la Pregunta
Service Configuration
#kubernetes
#horizontalpodautoscaler
#prometheus
#custom metrics
#autoscaling
Medio

Which tools enable Kubernetes HorizontalPodAutoscalers to use custom, application-generated metrics to trigger scaling events?

A

Prometheus and the prometheus-adapter.

Correcto
B

Graylog and graylog-autoscaler metrics.

C

Graylog and the kubernetes-adapter.

D

Grafana and Prometheus.

Explicación Oficial / Explicaciones de la Comunidad

The correct tool combination is Prometheus and the prometheus-adapter. The HorizontalPodAutoscaler (HPA) in Kubernetes can scale pods based on custom metrics, not just CPU/memory. To use application-generated metrics, you need a metrics adapter that implements the custom.metrics.k8s.io API. Prometheus collects metrics from applications, and the prometheus-adapter (also known as k8s-prometheus-adapter) exposes those metrics to the Kubernetes API server, allowing the HPA to query them.

How it works:

  1. Prometheus scrapes custom metrics from application endpoints (e.g., /metrics).
  2. The prometheus-adapter is configured with rules to map Prometheus metrics to Kubernetes custom metrics.
  3. The HPA references these custom metrics in its configuration (e.g., type: Object or type: Pods with a metric name).
  4. The HPA queries the custom.metrics.k8s.io API, which the adapter serves, and scales pods accordingly.

Why the incorrect options are wrong:

  • Graylog is a log management system, not a metrics collector. It does not provide a metrics API for HPA. The graylog-autoscaler metrics and kubernetes-adapter are not standard Kubernetes components.
  • Grafana is a visualization tool; it does not expose metrics to the Kubernetes API. While Prometheus is correct, Grafana alone cannot serve custom metrics to HPA.

Only Prometheus with the prometheus-adapter enables HPA to use custom application metrics for scaling.