Auto scaling dynamically adjusts compute resources based on your workload and policies. Typical scenarios include elastic online services, large-scale training, and GPU or shared-GPU deep learning. This topic describes the scaling solutions supported by Container Service for Kubernetes (ACK).
Two dimensions of scaling:
-
Horizontal vs. vertical: Horizontal scaling adjusts pod replica count. Vertical scaling adjusts CPU and memory per pod without changing the replica count.
-
Reactive vs. predictive: Reactive scaling responds to current metrics. Predictive scaling uses historical data to scale ahead of anticipated demand.
The four solutions:
| Solution | How it works | Scaling metrics | Use case | Supported resources | Documentation |
|---|---|---|---|---|---|
| HPA (Horizontal Pod Autoscaler) | Standard Kubernetes horizontal scaler. Scales replicas out when demand spikes and in when demand drops. | CPU and memory usage; custom metrics | Services with unpredictable traffic spikes — e-commerce, online education, and financial services | Deployments and StatefulSets (any resource that implements the scale interface) |
Horizontal pod autoscaling |
| CronHPA (Cron Horizontal Pod Autoscaler) | Scales pods on a cron schedule. Supports time zones, specific dates, and exclusion dates such as holidays. Works alongside HPA. | Schedule-based | Applications with predictable peaks or time-specific tasks | Deployments and StatefulSets | Use CronHPA for scheduled horizontal scaling |
| VPA (Vertical Pod Autoscaler) | Right-sizes pod CPU and memory requests and limits — without changing the replica count. | Recommends and adjusts CPU and memory requests and limits per pod | Stateful or monolithic applications needing stable resources; also useful for pod anomaly recovery | Deployments, DaemonSets, and StatefulSets | Vertical pod autoscaling |
| AHPA (Advanced Horizontal Pod Autoscaler) | Extends HPA with predictive scaling. Forecasts demand from historical metrics and scales pods before traffic arrives. | CPU, memory, and GPU usage; queries per second (QPS); response time (RT); custom metrics | Applications with periodic traffic patterns — live streaming, online education, and gaming | Deployments and Knative Services | AHPA overview |