容器编排技术 -- Kubernetes kubectl autoscale 命令详解

  • 1 kubectl autoscale
  • 2 语法
  • 3 示例
  • 4 Flags

kubectl autoscale

使用 autoscaler 自动设置在kubernetes集群中运行的pod数量(水平自动伸缩)。

指定Deployment、ReplicaSet或ReplicationController,并创建已经定义好资源的自动伸缩器。使用自动伸缩器可以根据需要自动增加或减少系统中部署的pod数量。

语法

$ autoscale (-f FILENAME | TYPE NAME | TYPE/NAME) [--min=MINPODS] --max=MAXPODS [--cpu-percent=CPU] [flags]

示例

使用 Deployment “foo”设定,使用默认的自动伸缩策略,指定目标CPU使用率,使其Pod数量在2到10之间。

kubectl autoscale deployment foo --min=2 --max=10

使用RC“foo”设定,使其Pod的数量介于1和5之间,CPU使用率维持在80%。

kubectl autoscale rc foo --max=5 --cpu-percent=80

Flags

Name Shorthand Default Usage
allow-missing-template-keys   true If true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats.
cpu-percent   -1 The target average CPU utilization (represented as a percent of requested CPU) over all the pods. If it's not specified or negative, a default autoscaling policy will be used.
dry-run   false If true, only print the object that would be sent, without sending it.
filename f [] Filename, directory, or URL to files identifying the resource to autoscale.
generator   horizontalpodautoscaler/v1 The name of the API generator to use. Currently there is only 1 generator.
include-extended-apis   true If true, include definitions of new APIs via calls to the API server. [default true]
max   -1 The upper limit for the number of pods that can be set by the autoscaler. Required.
min   -1 The lower limit for the number of pods that can be set by the autoscaler. If it's not specified or negative, the server will apply a default value.
name     The name for the newly created object. If not specified, the name of the input resource will be used.
no-headers   false When using the default or custom-column output format, don't print headers (default print headers).
output o   Output format. One of: json|yaml|wide|name|custom-columns=...|custom-columns-file=...|go-template=...|go-template-file=...|jsonpath=...|jsonpath-file=... See custom columns [http://kubernetes.io/docs/user-guide/kubectl-overview/#custom-columns], golang template [http://golang.org/pkg/text/template/#pkg-overview] and jsonpath template [http://kubernetes.io/docs/user-guide/jsonpath].
output-version     DEPRECATED: To use a specific API version, fully-qualify the resource, version, and group (for example: 'jobs.v1.batch/myjob').
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.
save-config   false If true, the configuration of current object will be saved in its annotation. Otherwise, the annotation will be unchanged. This flag is useful when you want to perform kubectl apply on this object in the future.
show-all a false When printing, show all resources (default hide terminated pods.)
show-labels   false When printing, show all labels as the last column (default hide labels column)
sort-by     If non-empty, sort list types using this field specification. The field specification is expressed as a JSONPath expression (e.g. '{.metadata.name}'). The field in the API resource specified by this JSONPath expression must be an integer or a string.
template     Template string or path to template file to use when -o=go-template, -o=go-template-file. The template format is golang templates [http://golang.org/pkg/text/template/#pkg-overview].

容器编排技术 -- Kubernetes kubectl autoscale 命令详解相关推荐

  1. 容器编排技术 -- Kubernetes kubectl scale 命令详解

    容器编排技术 -- Kubernetes kubectl scale 命令详解 1 kubectl scale 2 语法 3 示例 4 Flags kubectl scale 扩容或缩容 Deploy ...

  2. 容器编排技术 -- Kubernetes kubectl rolling-update 命令详解

    容器编排技术 -- Kubernetes kubectl rolling-update 命令详解 1 kubectl rolling-update 2 语法 3 示例 4 Flags kubectl ...

  3. 容器编排技术 -- Kubernetes kubectl replace 命令详解

    容器编排技术 -- Kubernetes kubectl replace 命令详解 1 kubectl replace 2 语法 3 示例 4 Flags kubectl replace 使用配置文件 ...

  4. 容器编排技术 -- Kubernetes kubectl patch 命令详解

    容器编排技术 -- Kubernetes kubectl patch 命令详解 1 kubectl patch 2 语法 3 示例 4 Flags kubectl patch 使用(patch)补丁修 ...

  5. 容器编排技术 -- Kubernetes kubectl label 命令详解

    容器编排技术 -- Kubernetes kubectl label 命令详解 1 kubectl label 2 语法 3 示例 4 Flags kubectl label 更新(增加.修改或删除) ...

  6. 容器编排技术 -- Kubernetes kubectl get 命令详解

    容器编排技术 -- Kubernetes kubectl get 命令详解 1 kubectl get 2 语法 3 示例 4 Flags kubectl get 获取列出一个或多个资源的信息. 可以 ...

  7. 容器编排技术 -- Kubernetes kubectl edit 命令详解

    容器编排技术 -- Kubernetes kubectl edit 命令详解 1 kubectl edit 2 语法 3 示例 4 Flags kubectl edit 使用默认编辑器 编辑服务器上定 ...

  8. 容器编排技术 -- Kubernetes kubectl delete 命令详解

    容器编排技术 -- Kubernetes kubectl delete 命令详解 1 kubectl delete 2 语法 3 示例 4 Flags kubectl delete 通过配置文件名.s ...

  9. 容器编排技术 -- Kubernetes kubectl create 命令详解

    容器编排技术 -- Kubernetes kubectl create 命令详解 1 kubectl create 2 语法 3 示例 4 Flags kubectl create 通过配置文件名或s ...

最新文章

  1. 那些顶级的AI机器人“大脑”
  2. python五十一:动态导入模块,通过字符串导入模块
  3. HTML5_1 笔记
  4. JVM常用的参数配置
  5. hdoj 1285 确定比赛名次 【拓扑排序】
  6. android版本怎么设置,安卓系统手机怎么用
  7. ios 图片居中裁剪_iOS实现图片的缩放和居中显示
  8. 利用 caffe的 python接口测试训练好的 mnist 模型
  9. 正在爆发的互联网革命
  10. 开心网(kaixin001.com)服务器架构的一点猜想
  11. 程序员面试金典--变位词排序
  12. 从mp4,flv文件中解析出h264和aac,送解码器解码失败
  13. Unity导入免费的素材资源
  14. 记一次hsql解析大json的全过程
  15. C++的 new 和 detele
  16. 强网杯 2018 core ROP做法
  17. 万有引力的意思_万有引力的本质是什么?
  18. kali linux 入侵教程,kali linux 入侵wordpress! wpscan工具使用方法!
  19. 三角形面积的计算公式,外接圆半径
  20. 域名检测工具-免费老域名扫描软件下载

热门文章

  1. petshop4.0 详解之三(PetShop数据访问层之消息处理)
  2. 防止网页被嵌入框架的代码
  3. magento 问题解答 FQA
  4. redis的淘汰策略
  5. python——asyncio模块实现协程、异步编程(一)
  6. ubuntu分辨率设置
  7. 【matlab】找出数组中符合条件的数并赋值
  8. Nginx学习之十二-负载均衡-加权轮询策略剖析
  9. 组合框绑定字符串数组的数据 c# 1614236088
  10. xlwt写操作基本代码