Kubernetes manifests · Scaling and access control
Autoscale on CPU
Scale a Deployment between 2 and 10 replicas to keep CPU near 70%. Needs metrics-server.
apiVersion: autoscaling/v2
kind: HorizontalPodAutoscaler
metadata:
name: web
spec:
scaleTargetRef:
apiVersion: apps/v1
kind: Deployment
name: web
minReplicas: 2
maxReplicas: 10
metrics:
- type: Resource
resource:
name: cpu
target:
type: Utilization
averageUtilization: 70
Official Kubernetes manifests documentation
More scaling and access control commands
All scaling and access control commands · Kubernetes manifests cheatsheet