• 欢迎访问蜷缩的蜗牛博客 蜷缩的蜗牛
  • 微信搜索: 蜷缩的蜗牛 | 联系站长 kbsonlong@qq.com
  • 如果您觉得本站非常有看点,那么赶紧使用Ctrl+D 收藏吧

kubectl scale(扩缩Pod数量)

kubectl命令表 蜷缩的蜗牛 3个月前 (06-20) 10次浏览 已收录

kubectl scale

扩容或缩容 Deployment、ReplicaSet、Replication Controller 或 Job 中 Pod 数量。

scale 也可以指定多个前提条件,如:当前副本数量或 –resource-version ,进行伸缩比例设置前,系统会先验证前提条件是否成立。

语法

$ scale [--resource-version=version] [--current-replicas=count] --replicas=COUNT (-f FILENAME | TYPE NAME)

示例

将名为 foo 中的 pod 副本数设置为 3。

kubectl scale --replicas=3 rs/foo

将由“foo.yaml”配置文件中指定的资源对象和名称标识的 Pod 资源副本设为 3。

kubectl scale --replicas=3 -f foo.yaml

如果当前副本数为 2,则将其扩展至 3。

kubectl scale --current-replicas=2 --replicas=3 deployment/mysql

设置多个 RC 中 Pod 副本数量。

kubectl scale --replicas=5 rc/foo rc/bar rc/baz

Flags

Name Shorthand Default Usage
current-replicas -1 Precondition for current size. Requires that the current size of the resource match this value in order to scale.
filename f [] Filename, directory, or URL to files identifying the resource to set a new size
include-extended-apis true If true, include definitions of new APIs via calls to the API server. [default true]
output o Output mode. Use “-o name” for shorter output (resource/name).
record false Record current kubectl command in the resource annotation. If set to false, do not record the command. If set to true, record the command. If not set, default to updating the existing annotation value only if one already exists.
recursive R false Process the directory used in -f, –filename recursively. Useful when you want to manage related manifests organized within the same directory.
replicas -1 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.
timeout 0s The length of time to wait before giving up on a scale operation, zero means don’t wait. Any other values should contain a corresponding time unit (e.g. 1s, 2m, 3h).
K8S 中文社区微信公众号

本文转载自 kubectl scale(扩缩 Pod 数量)


蜷缩的蜗牛 , 版权所有丨如未注明 , 均为原创丨 转载请注明kubectl scale(扩缩 Pod 数量)
喜欢 (0)
[]
分享 (0)