Change replica count
high risk
kubectl get deploy/<name> -o jsonpath="{.spec.replicas}"Record the current valuekubectl scale deploy/<name> --replicas=<n> --current-replicas=<old>Use a preconditionSets replicas of deployments/statefulsets.
| Flag | Meaning |
|---|---|
--replicas --replicas | Desired count |
--current-replicas --current-replicas | Precondition |
kubectl scale deploy/web --replicas=5Scale up · explain & risk-check →kubectl scale deploy/web --replicas=0Stop (outage!) · explain & risk-check →Reference text is hand-written and may be incomplete — check man kubectl for your version. Test destructive commands on a non-production system first.