Custom metric values and scaling decisions

Custom metric values and scaling decisions An architecture diagram generated by Archify. Application metrics · /metrics endpoint · Architecture component Application metrics /metrics endpoint Prometheus Server · scrape · store · query · Architecture component Prometheus Server scrape · store · query Prometheus Adapter · Metric names and query rules · Architecture component Prometheus Adapter Metric names and query rules API aggregation · custom.metrics.k8s.io · Architecture component API aggregation custom.metrics.k8s.io HPA controller · Replica recommendation · Architecture component HPA controller Replica recommendation Deployment /scale · Update desired replicas · Architecture component Deployment /scale Update desired replicas Scraped samples Query results Aggregated response Metric response Update /scale Legend Frontend Backend Cloud

Arrows show returned values

  • • Prometheus scrapes the application /metrics endpoint
  • • The adapter queries Prometheus; HPA reads the aggregated API

Separate API ownership

  • • This adapter example serves custom.metrics.k8s.io only
  • • Metrics-server serves CPU/memory; KEDA serves external metrics
  • • Avoid competing owners of the same APIService

Timing and failure handling

  • • Scraping, queries, HPA reconciliation and Pod readiness add latency
  • • Multiple metrics select the largest replica recommendation
  • • Missing data does not mean zero load or healthy operation