No1*_*ver 4 google-cloud-platform kubernetes kubectl
我在 Google Cloud 中托管了 Kubernetes 集群。我创建了一个部署并为其定义了一个 hpa 规则:
kubectl autoscale deployment my_deployment --min 6 --max 30 --cpu-percent 80
Run Code Online (Sandbox Code Playgroud)
我想运行一个编辑--min值的命令,而不删除并重新创建一个新的 hpa rule。就像是:
$ kubectl autoscale deployment my_deployment --min 1 --max 30
Error from server (AlreadyExists): horizontalpodautoscalers.autoscaling "my_deployment" already exists
Run Code Online (Sandbox Code Playgroud)
这可以在命令行上编辑 hpa (min, max, cpu-percent, ...) 吗?
mda*_*iel 14
这可以在命令行上编辑 hpa (min, max, cpu-percent, ...) 吗?
它们就像任何其他资源一样可编辑,但无论是kubectl edit hpa $the_hpa_name用于交互式编辑,还是kubectl patch hpa $the_hpa_name -p '{"spec":{"minReplicas": 1}}'在“批处理”设置中进行。
如果您不知道$the_hpa_name,您可以像任何其他资源一样获取它们的列表:kubectl get hpa,同样您可以查看当前设置和状态kubectl get -o yaml hpa $the_hpa_name(甚至省略$the_hpa_name查看它们,但这可能是很多文本,取决于您的集群设置)。
| 归档时间: |
|
| 查看次数: |
2764 次 |
| 最近记录: |