【问题标题】:Horizontal Pods Autoscaling (HPA) on GKE based on GPU utilization基于 GPU 利用率的 GKE 上的 Horizo​​ntal Pods Autoscaling (HPA)
【发布时间】:2020-02-20 06:27:47
【问题描述】:

我正在尝试基于 GPU 利用率在 GCP 中实现水平 Pods Autoscaling (HPA)。 我的 hpa.yaml 文件如下所示:

kind: HorizontalPodAutoscaler
metadata:
  name: my-hpa
spec:
  minReplicas: 1
  maxReplicas: 10
  metrics:
  - type: External
    external:
     metricName: kubernetes.io|container|accelerator|duty_cycle
      targetAverageValue: 10
  scaleTargetRef:
    apiVersion: apps/v1
    kind: Deployment
    name: my-container-worker

运行 kubectl create -f hpa.yaml 后,我在 GCP 中看到以下错误。

在 HPA 上,它说无法读取所有指标。

在堆栈驱动程序监控中,我使用上述指标创建了一个仪表板。

有人遇到过这个问题吗?

【问题讨论】:

  • 尝试使用compute.googleapis.com|container|accelerator|duty_cycle
  • 这似乎也不起作用..我得到同样的错误
  • 确保您正确部署了Custom Metrics Stackdriver Adapter 并且它的正在运行。我刚刚用 hpa 和 gpus 创建了一个 gke 集群,一切似乎都对我有用。
  • 谢谢你.. 它现在似乎工作了。我只需要找出有效的 targetAverageValue 即可。你通常把它设置成什么?
  • 现在我得到了,当我运行 kubectl describe hpa Warning FailedComputeMetricsReplicas 43m horizontal-pod-autoscaler failed to get kubernetes.io|container|accelerator|duty_cycle external metric: unable to get external metric default/kubernete s.io|container|accelerator|duty_cycle/&LabelSelector{MatchLabels:map[string]string{},MatchExpressions:[],}: unable to fetch metrics from external metrics API: the server is currently unable to handle the request ( get kubernetes.io|container|accelerator|duty_cycle.external.metrics.k8s.io) 时出现此错误

标签: kubernetes google-compute-engine google-kubernetes-engine kubernetes-pod hpa


【解决方案1】:

总结我们在 cmets 中的对话:

要在 Kubernetes 中使用 GCP 指标,必须部署 Custom Metrics Stackdriver Adapter。这就是 HPA 无法读取指标并因此引发错误的原因。

【讨论】:

    猜你喜欢
    • 2019-08-22
    • 1970-01-01
    • 2018-02-18
    • 2020-10-24
    • 1970-01-01
    • 1970-01-01
    • 2019-05-23
    • 2022-08-20
    • 2019-09-25
    相关资源
    最近更新 更多