【发布时间】:2020-02-20 10:19:29
【问题描述】:
我已经为我的部署创建了 HPA,它可以很好地扩展到最大副本(在我的情况下为 6),当负载将其规模缩小到 5 但它应该达到我的原始副本状态(在我的情况下为 1情况下)随着负载变得正常。我在 30-40 分钟后验证了我的应用程序仍然有 5 个副本.. 它应该是 1 个副本。
[ec2-user@ip-192-168-x-x ~]$ kubectl describe hpa admin-dev -n dev
Name: admin-dev
Namespace: dev
Labels: <none>
Annotations: <none>
CreationTimestamp: Thu, 24 Oct 2019 07:36:32 +0000
Reference: Deployment/admin-dev
Metrics: ( current / target )
resource memory on pods (as a percentage of request): 49% (1285662037333m) / 60%
Min replicas: 1
Max replicas: 10
Deployment pods: 3 current / 3 desired
Conditions:
Type Status Reason Message
---- ------ ------ -------
AbleToScale True ReadyForNewScale recommended size matches current size
ScalingActive True ValidMetricFound the HPA was able to successfully calculate a replica count from memory resource utilization (percentage of request)
ScalingLimited False DesiredWithinRange the desired count is within the acceptable range
Events:
Type Reason Age From Message
---- ------ ---- ---- -------
Normal SuccessfulRescale 13m horizontal-pod-autoscaler New size: 2; reason: memory resource utilization (percentage of request) above target
Normal SuccessfulRescale 5m27s horizontal-pod-autoscaler New size: 3; reason: memory resource utilization (percentage of request) above target
【问题讨论】:
-
但是 CPU 负载的百分比是多少?是否低于阈值?
-
@suren 是的,它是正常的,仅低于我的目标。
-
@LakshmiReddy 你能粘贴
kubectl describe hpa <your-hpa>的输出吗? -
@vesna , [ec2-user@ip-192-168-xx ~]$ kubectl describe hpa admin-dev -n dev 名称:admin-dev 命名空间:dev 标签:
注释: CreationTimestamp: Thu, 24 Oct 2019 07:36:32 +0000 Reference: Deployment/admin-dev Metrics: ( current / target ) Pod 上的资源内存(占请求的百分比):49% (1285662037333m) / 60 % 最小副本:1 最大副本:10 部署 pod:3 个当前 / 3 个期望 -
@vesna,条件:类型状态原因消息 ---- ------ ------ -------- AbleToScale True ReadyForNewScale 推荐大小与当前大小匹配 ScalingActive True ValidMetricFound HPA 能够成功地从内存资源利用率(请求的百分比)计算副本计数 ScalingLimited False DesiredWithinRange 所需的计数在可接受的范围内