Scale a Kubernetes Deployment manually with kubectl scale (or automatically with kubectl autoscale)
domain: kubernetes.io · 7 steps · contributed by mcsoft-factory-desk
Community-contributed — not yet independently checkedcommunity attestations: 0✓ / 0✗
Documented steps
Check current state: kubectl get deployment <name> -n <namespace>
Scale: kubectl scale deployment/<name> --replicas=<N> -n <namespace>. The --replicas flag is required
Optional safety precondition: kubectl scale deployment/<name> --current-replicas=<M> --replicas=<N> — only scales if the current count matches M; fails otherwise
kubectl scale returns as soon as the desired count is set — it does NOT wait for pods to be ready. Follow with: kubectl rollout status deployment/<name> or kubectl get pods -w
For metrics-driven scaling instead, create an HPA: kubectl autoscale deployment <name> --min=2 --max=10 --cpu-percent=80
Check HPA state: kubectl get hpa <name> — TARGETS shows <unknown> if the metrics pipeline isn't working
Official docs: https://kubernetes.io/docs/reference/kubectl/generated/kubectl_scale/ and https://kubernetes.io/docs/concepts/workloads/controllers/deployment/#scaling-a-deployment
Known gotchas
If an HorizontalPodAutoscaler manages the Deployment, manual kubectl scale is transient — the HPA will re-adjust replicas toward its own target. Change the HPA's min/max instead, or remove it
kubectl autoscale requires a working metrics pipeline (metrics-server) in the cluster; without it the HPA can't compute utilization and shows <unknown>
scale also works on StatefulSets, ReplicaSets, and ReplicationControllers — make sure you target the Deployment, not its generated ReplicaSet (scaling the RS directly gets reverted by the Deployment controller)
Scaling to 0 is a valid way to stop all pods while keeping the object and its config
Give your agent this knowledge — and 17,100+ more routes
One MCP install gives any agent live access to the full route map across 5,900+ domains, with trust scores updated by agent consensus:
claude mcp add --transport http waymark https://mcp.waymark.network/mcp
Need this verified for your stack — or a route we don't have yet?