Kubernetes水平Pod自动缩放器无法按预期缩放

时间:2019-04-02 23:40:20

标签: kubernetes amazon-eks eks

在Kubernetes自动缩放器上执行负载测试时,我发现当当前mem值达到7783765333m时,自动缩放副本将停止。

还有其他人看到过这种行为吗?

我正在容器上运行Web服务器,并使用“嘿”进行负载测试。

kind: HorizontalPodAutoscaler
metadata:
  name: php-apache
  namespace: flux
spec:
  scaleTargetRef:
    apiVersion: extensions/v1beta1
    kind: Deployment
    name: php-apache
  minReplicas: 1
  maxReplicas: 10
  metrics:
#  - type: Resource
#    resource:
#      name: cpu
#      targetAverageUtilization: 500000
  - type: Resource
    resource:
      name: memory
      targetAverageValue: 7082560
kind: HorizontalPodAutoscaler
metadata:
  annotations:
    autoscaling.alpha.kubernetes.io/conditions: '[{"type":"AbleToScale","status":"True","lastTransitionTime":"2019-04-02T21:47:41Z","reason":"ReadyForNewScale","message":"the
      last scale time was sufficiently old as to warrant a new scale"},{"type":"ScalingActive","status":"True","lastTransitionTime":"2019-04-02T21:38:16Z","reason":"ValidMetricFound","message":"the
      HPA was able to successfully calculate a replica count from memory resource"},{"type":"ScalingLimited","status":"False","lastTransitionTime":"2019-04-02T21:38:16Z","reason":"DesiredWithinRange","message":"the
      desired count is within the acceptable range"}]'
    autoscaling.alpha.kubernetes.io/current-metrics: '[{"type":"Resource","resource":{"name":"memory","currentAverageValue":"7783765333m"}}]'
    autoscaling.alpha.kubernetes.io/metrics: '[{"type":"Resource","resource":{"name":"memory","targetAverageValue":"7082560"}}]'
    kubectl.kubernetes.io/last-applied-configuration: |
      {"apiVersion":"autoscaling/v2beta1","kind":"HorizontalPodAutoscaler","metadata":{"annotations":{},"name":"hello-world","namespace":"flux"},"spec":{"maxReplicas":10,"metrics":[{"resource":{"name":"memory","targetAverageValue":7082560},"type":"Resource"}],"minReplicas":1,"scaleTargetRef":{"apiVersion":"extensions/v1beta1","kind":"Deployment","name":"hello-world"}}}
  creationTimestamp: "2019-04-02T21:37:46Z"
  name: hello-world
  namespace: flux
  resourceVersion: "18502599"
  selfLink: /apis/autoscaling/v1/namespaces/flux/horizontalpodautoscalers/hello-world
  uid: 8e5f4ca3-558f-11e9-900d-064fc6bb52e2
spec:
  maxReplicas: 10
  minReplicas: 1
  scaleTargetRef:
    apiVersion: extensions/v1beta1
    kind: Deployment
    name: hello-world
status:
  currentReplicas: 3
  desiredReplicas: 3
  lastScaleTime: "2019-04-02T21:41:41Z"

尽管内存使用率很高,但您在这里看到的副本数不再增加。

$ kubectl get hpa

Tue Apr  2 15:19:13 PDT 2019
NAME          REFERENCE                TARGETS               MINPODS   MAXPODS   REPLICAS   AGE
hello-world   Deployment/hello-world   7783765333m/7082560   1         10        3          41m

Tue Apr  2 15:19:23 PDT 2019
NAME          REFERENCE                TARGETS               MINPODS   MAXPODS   REPLICAS   AGE
hello-world   Deployment/hello-world   7783765333m/7082560   1         10        3          41m

Tue Apr  2 15:19:34 PDT 2019
NAME          REFERENCE                TARGETS               MINPODS   MAXPODS   REPLICAS   AGE
hello-world   Deployment/hello-world   7783765333m/7082560   1         10        3          41m

Tue Apr  2 15:19:44 PDT 2019
NAME          REFERENCE                TARGETS           MINPODS   MAXPODS   REPLICAS   AGE
hello-world   Deployment/hello-world   8568832/7082560   1         10        
3          41m

Tue Apr  2 15:19:55 PDT 2019
NAME          REFERENCE                TARGETS           MINPODS   MAXPODS   REPLICAS   AGE
hello-world   Deployment/hello-world   8568832/7082560   1         10        3          42m

Tue Apr  2 15:20:05 PDT 2019
NAME          REFERENCE                TARGETS           MINPODS   MAXPODS   REPLICAS   AGE
hello-world   Deployment/hello-world   8568832/7082560   1         10        3          42m

Tue Apr  2 15:20:16 PDT 2019
NAME          REFERENCE                TARGETS           MINPODS   MAXPODS   REPLICAS   AGE
hello-world   Deployment/hello-world   8568832/7082560   1         10        4          42m

Tue Apr  2 15:20:26 PDT 2019
NAME          REFERENCE                TARGETS           MINPODS   MAXPODS   REPLICAS   AGE
hello-world   Deployment/hello-world   8568832/7082560   1         10        4          42m

0 个答案:

没有答案