Horizontal Pod Autoscaler (HPA)
The Horizontal Pod Autoscaler (HPA) automatically scales the number of Pod replicas in a Deployment or StatefulSet based on observed metrics like CPU or memory utilization.
apiVersion: autoscaling/v2kind: HorizontalPodAutoscalermetadata: name: backend-hpaspec: scaleTargetRef: apiVersion: apps/v1 kind: Deployment name: backend-api minReplicas: 2 maxReplicas: 10 metrics: - type: Resource resource: name: cpu target: type: Utilization averageUtilization: 75