kubectl autoscale deploy/web --min=2 --max=10 --cpu-percent=70

Category: Kubernetes & Containers

kubectl autoscale deploy/web --min=2 --max=10 --cpu-percent=70

Set up automatic pod autoscaling

Creates a HorizontalPodAutoscaler (HPA) that keeps the deployment between 2 and 10 replicas based on CPU usage. The cluster needs the metrics server installed, for example minikube addons enable metrics-server. Check kubectl get hpa to see the current target and actual replicas.
Looking for more? Search all 7,657 commands — works offline, in English or Spanish, and fixes typos.