Horizontal Pod Autoscaler Operations
Jump to navigation
Jump to search
Internal
Create an Autoscaler
CPU-Based Autoscaler
For the autoscaler to work, the pods subject to autoscaling must have their CPU requests set.
With CLI
kubectl autoscale deployment <deployment-name> --cpu-percent=50 --min=1 --max=10
With Metadata
apiVersion: autoscaling/v2beta2
kind: HorizontalPodAutoscaler
metadata:
name: example
spec:
minReplicas: 1
maxReplicas: 5
scaleTargetRef:
apiVersion: apps/v1
kind: Deployment
name: httpd
metrics:
- type: Resource
resource:
name: cpu
target:
type: Utilization
averageUtilization: 50
Playground
Horizontal Pod Autoscaler Controller Configuration
--horizontal-pod-autoscaler-sync-period
Sets the period of the control loop. By default, the value is 15 seconds.
--horizontal-pod-autoscaler-tolerance
See:
--horizontal-pod-autoscaler-initial-readiness-delay
--horizontal-pod-autoscaler-cpu-initialization-period
--horizontal-pod-autoscaler-downscale-stabilization
The value for this option is a duration that specifies how long the autoscaler has to wait before another downscale operation can be performed after the current one has completed. The default value is 5 minutes. Also see: