gpt4 book ai didi

kubernetes - HPA在GKE上的规模部署为0

转载 作者:行者123 更新时间:2023-12-02 11:55:19 27 4
gpt4 key购买 nike

我正在尝试将HPA与外部指标结合使用,以将部署缩减到0。我在将GKE与1.16.9-gke.2版一起使用。

根据this的说法,我认为它会起作用,但是没有用。我仍然面对:The HorizontalPodAutoscaler "classifier" is invalid: spec.minReplicas: Invalid value: 0: must be greater than or equal to 1
以下是我的HPA定义:

apiVersion: autoscaling/v2beta1
kind: HorizontalPodAutoscaler
metadata:
name: classifier
spec:
minReplicas: 0
maxReplicas: 15
metrics:
- external:
metricName: loadbalancing.googleapis.com|https|request_count
targetAverageValue: "1"
type: External
scaleTargetRef:
apiVersion: apps/v1
kind: Deployment
name: classifier


非常感谢你的帮助 !

最佳答案

According to this I thought it would be working but it's not.


一些功能正在Kubernetes中运行的事实并不意味着它们在诸如GKE这样的托管解决方案中已启用。
此功能由 功能门启用,称为 HPAScaleToZero 。自Kubernetes 1.16版以来,它处于 Alpha 状态。默认情况下根据以下链接禁用它。
请在此处查看有关功能门的官方文档: Kubernetes.io: Docs: Feature Gates
更进一步:

New features in Kubernetes are listed as Alpha, Beta, or Stable, depending upon their status in development. In most cases, Kubernetes features that are listed as Beta or Stable are included with GKE

Cloud.google.com: Kubernetes Engine: Kubernetes versions and features


如您所见:

The HorizontalPodAutoscaler "classifier" is invalid: spec.minReplicas: Invalid value: 0: must be greater than or equal to 1


在“标准” GKE集群中禁用此功能。

有一个选项可以启用 HPAScaleToZero 。这需要运行一个 alpha 集群:

The term alpha cluster means that alpha APIs are enabled, both for Kubernetes and GKE, regardless of the version of Kubernetes the cluster runs. Periodically, Google offers customers the ability to test GKE versions that are not generally available, for testing and validation.

Cloud.google.com: Kubernetes Engine: Alpha clusters


请记住,运行 alpha 集群有一些缺点:

Limitations

Alpha clusters have the following limitations:

  • Not covered by the GKE SLA
  • Cannot be upgraded
  • Node auto-upgrade and auto-repair are disabled on alpha clusters
  • Automatically deleted after 30 days
  • Do not receive security updates

关于kubernetes - HPA在GKE上的规模部署为0,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/62412075/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com