语法
[14:31:39 root@ceshi-01 ~ $]kubectl scale --help
Set a new size for a Deployment, ReplicaSet, Replication Controller, or StatefulSet.
为Deployment,ReplicaSet,Replication Controller或StatefulSet设置新大小。
Scale also allows users to specify one or more preconditions for the scale action.
Scale还允许用户为缩放操作指定一个或多个前提条件。
If --current-replicas or --resource-version is specified, it is validated before the scale is attempted,
如果指定了--current-replicas或--resource-version,则在尝试扩展之前验证它,
and it is guaranteed that the precondition holds true when the scale is sent to the server.
当比例被发送到服务器时,前提条件确实成立。
示例:
# Scale a replicaset named 'foo' to 3.
# 将名为'foo'的复制集缩放为3。
kubectl scale --replicas=3 rs/foo
# Scale a resource identified by type and name specified in "foo.yaml" to 3.
# 将由“foo.yaml”中指定的类型和名称标识的资源缩放为3。
kubectl scale --replicas=3 -f foo.yaml
# If the deployment named mysql's current size is 2, scale mysql to 3.
# 如果名为mysql当前大小的部署为2,则将mysql扩展为3。
kubectl scale --current-replicas=2 --replicas=3 deployment/mysql
# Scale multiple replication controllers.
# 扩展多个复制控制器。
kubectl scale --replicas=5 rc/foo rc/bar rc/baz
# Scale statefulset named 'web' to 3.
# 将名为'web'的statefulset扩展为3。
kubectl scale --replicas=3 statefulset/web
选项:
--all=false: Select all resources in the namespace of the specified resource types
选择指定资源类型的命名空间中的所有资源
--allow-missing-template-keys=true: If true, ignore any errors in templates when a field or map key is missing in the template.
如果为true,则在模板中缺少字段或映射时忽略模板中的任何错误。
Only applies to golang and jsonpath output formats.
仅适用于golang和jsonpath输出格式。
--current-replicas=-1: Precondition for current size. Requires that the current size of the resource match this value in order to scale.
当前大小的前提条件。 要求资源的当前大小与此值匹配才能进行扩展。
-f, --filename=[]: Filename, directory, or URL to files identifying the resource to set a new size
标识要设置新大小的资源的文件的文件名,目录或URL
-k, --kustomize='': Process the kustomization directory. This flag can't be used together with -f or -R.
处理自定义目录。 该标志不能与-f或-R一起使用。
-o, --output='': Output format. One of:
输出格式
json|yaml|name|go-template|go-template-file|template|templatefile|jsonpath|jsonpath-file.
--record=false: Record current kubectl command in the resource annotation. If set to false, do not record the command.
在资源注释中记录当前kubectl命令。 如果设置为false,请不要记录该命令。
If set to true, record the command. If not set, default to updating the existing annotation value only if one already exists.
如果设置为true,则记录该命令。 如果未设置,则默认仅在已存在的情况下更新现有注释值。
-R, --recursive=false: Process the directory used in -f, --filename recursively.
递归处理
Useful when you want to manage related manifests organized within the same directory.
--replicas=0: The new desired number of replicas. Required.
新的所需数量的副本。必需。
--resource-version='': Precondition for resource version. Requires that the current resource version match this value in order to scale.
资源版本的前提条件。 要求当前资源版本与此值匹配才能进行扩展。
-l, --selector='': Selector (label query) to filter on, supports '=', '==', and '!='.(e.g. -l key1=value1,key2=value2)
标签过滤器
--template='': Template string or path to template file to use when -o=go-template, -o=go-template-file.
当-o = go-template,-o = go-template-file时,模板字符串或模板路径。
The template format is golang templates [http://golang.org/pkg/text/template/#pkg-overview].
模板格式是golang模板[http://golang.org/pkg/text/template/#pkg-overview]。
--timeout=0s: The length of time to wait before giving up on a scale operation, zero means don't wait.
在放弃缩放操作之前等待的时间长度,为0意味着不要等待。
Any other values should contain a corresponding time unit (e.g. 1s, 2m, 3h).
任何其他值应包含相应的时间单位(例如1s,2m,3h)。
用法:
kubectl scale [--resource-version=version] [--current-replicas=count] --replicas=COUNT (-f FILENAME | TYPE NAME)
[options]
Use "kubectl options" for a list of global command-line options (applies to all commands).
网友评论