kubectl scale
Deployment, ReplicaSet StatefulSet
Syntax
kubectl scale <resource> <name> --replicas=<count> [flags]
Parameters
| Parameters | Description | Examples | Level |
|---|---|---|---|
--replicas |
kubectl scale deployment web --replicas=5 |
Common | |
--current-replicas |
: | kubectl scale deployment web --current-replicas=3 --replicas=5 |
Advanced |
--timeout |
and more | kubectl scale deployment web --replicas=10 --timeout=60s |
Advanced |
Examples
5
kubectl scale deployment web-app --replicas=5
1
kubectl scale deployment web-app --replicas=1
0()
kubectl scale deployment web-app --replicas=0
Deployment Pod
kubectl scale deployment web-app --current-replicas=3 --replicas=5
3 5,
Common Errors
the server could not find the requested resourcescale(Deployment/ReplicaSet/StatefulSet)
cannot scale a resource that doesn't existand
Tips
- HPA(Horizontal Pod Autoscaler)
- scale 0, Deployment
- StatefulSet Pod