kubectl: Support scaling deployments

This commit adds support for using kubectl scale to scale deployments. Makes use of the
deployments/scale endpoint instead of updating deployment.spec.replicas directly.
This commit is contained in:
Michail Kargakis
2015-11-13 13:44:03 +01:00
parent a7425bf070
commit 99fc35880b
11 changed files with 558 additions and 200 deletions

View File

@@ -3,7 +3,7 @@
.SH NAME
.PP
kubectl scale \- Set a new size for a Replication Controller.
kubectl scale \- Set a new size for a Replication Controller, Job, or Deployment.
.SH SYNOPSIS
@@ -13,7 +13,7 @@ kubectl scale \- Set a new size for a Replication Controller.
.SH DESCRIPTION
.PP
Set a new size for a Replication Controller.
Set a new size for a Replication Controller, Job, or Deployment.
.PP
Scale also allows users to specify one or more preconditions for the scale action.
@@ -25,11 +25,11 @@ scale is sent to the server.
.SH OPTIONS
.PP
\fB\-\-current\-replicas\fP=\-1
Precondition for current size. Requires that the current size of the replication controller match this value in order to scale.
Precondition for current size. Requires that the current size of the resource match this value in order to scale.
.PP
\fB\-f\fP, \fB\-\-filename\fP=[]
Filename, directory, or URL to a file identifying the replication controller to set a new size
Filename, directory, or URL to a file identifying the resource to set a new size
.PP
\fB\-o\fP, \fB\-\-output\fP=""
@@ -148,16 +148,19 @@ scale is sent to the server.
.nf
# Scale replication controller named 'foo' to 3.
$ kubectl scale \-\-replicas=3 replicationcontrollers foo
$ kubectl scale \-\-replicas=3 rc/foo
# Scale a replication controller identified by type and name specified in "foo\-controller.yaml" to 3.
$ kubectl scale \-\-replicas=3 \-f foo\-controller.yaml
# Scale a resource identified by type and name specified in "foo.yaml" to 3.
$ kubectl scale \-\-replicas=3 \-f foo.yaml
# If the replication controller named foo's current size is 2, scale foo to 3.
$ kubectl scale \-\-current\-replicas=2 \-\-replicas=3 replicationcontrollers foo
# If the deployment named mysql's current size is 2, scale mysql to 3.
$ kubectl scale \-\-current\-replicas=2 \-\-replicas=3 deployment/mysql
# Scale multiple replication controllers.
$ kubectl scale \-\-replicas=5 rc/foo rc/bar
$ kubectl scale \-\-replicas=5 rc/foo rc/bar rc/baz
# Scale job named 'cron' to 3.
$ kubectl scale \-\-replicas=3 job/cron
.fi
.RE