liveBook · Manning

External metric

As explained in Kubernetes for Developers

An external metric is a monitoring measurement sourced outside a Kubernetes cluster and exposed for workload autoscaling.

An external metric is a monitoring measurement produced outside a Kubernetes cluster and made available to a Horizontal Pod Autoscaler (HPA). It lets workloads scale on signals Kubernetes does not provide directly, such as requests per second (RPS) or undelivered messages. section 6.2.1 section 6.2

RPS is useful when CPU utilization does not represent demand, especially for services that spend time waiting on external systems. If tested replica capacity is known, a simple planning rule is replica count = RPS ÷ replica capacity. section 6.2.1 section 6.2

Using an external metric for HTTP workload autoscaling requires:

  • Expose the workload through an Ingress so HTTP requests can be observed and measured. section 6.2.1

Scaling an HTTP service on RPS

A timeserver is exposed through an Ingress and monitored using Google Cloud’s request-count metric. An HPA sets one to six replicas and targets the selected forwarding rule. After a load test, kubectl reports 94% against a 30% target and four replicas, showing the HPA responding to external demand.

How Kubernetes for Developers covers it

How deep it goes
Explains the metric choice, Ingress path, resource selector, HPA configuration, load test, and observed scaling behavior.
Examples
Demonstrates Google Cloud request counts, an Ingress forwarding-rule selector, ApacheBench traffic, and kubectl scaling output.
What it assumes
Assumes basic Deployments and Services, while establishing why HTTP metrics require an Ingress and why CPU alone may be insufficient.
What you can do after
Apply it via an autoscaling/v2 HPA configured against an external monitoring metric and an identified workload resource.
How it connects
Connects external metrics with Horizontal Pod Autoscaler, Ingress, Service, monitoring systems, custom metrics, and capacity planning.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Kubernetes for Developers. The section links point to the parts of the book it draws on.