gpt4 book ai didi

kubernetes - Kubernetes水平Pod自动缩放器(HPA)测试

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

我们的Web服务API上似乎遇到了一些内部服务器错误(500),似乎是在作为自动缩放器配置的一部分引入或删除了新容器时。
自然,这种事情很难解决,因为您并不总是能够控制 pods 的启动和停止的时间。
是否可以使用一种机制来指示集群按比例扩展和缩小?
我们感兴趣的hpa.yaml

kind: HorizontalPodAutoscaler
apiVersion: autoscaling/v2beta2
metadata:
name: xyz
spec:
minReplicas: 1
maxReplicas: 12
scaleTargetRef:
apiVersion: apps/v1
kind: Deployment
name: xyz
behavior:
scaleUp:
stabilizationWindowSeconds: 0
policies:
- type: Percent
value: 100
periodSeconds: 15
scaleDown:
stabilizationWindowSeconds: 300
policies:
- type: Percent
value: 50
periodSeconds: 60
metrics:
- type: Resource
resource:
name: cpu
target:
type: Utilization
averageUtilization: 70
- type: Resource
resource:
name: memory
target:
type: Utilization
averageUtilization: 85

最佳答案

如果您有兴趣使HPA出于调试目的强行创建或销毁Pod,则可以在Horizo​​ntal Pod Autoscaler .yaml定义中使用自定义指标。
如果问题是新创建的Pod会导致错误,则可以在Pod定义中实现执行httpGet检查的就绪探针。这样,您可以避免在有问题的Pod上重定向流量,直到探测检查返回状态= 200。

关于kubernetes - Kubernetes水平Pod自动缩放器(HPA)测试,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/63267805/

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