【问题标题】:Kubernetes Autoscaler not working on Azure AKSKubernetes 自动缩放器无法在 Azure AKS 上运行
【发布时间】:2019-10-09 09:50:36
【问题描述】:

我在Azure 上创建了AKS 集群并创建了一些部署。由于我的一项部署需要autoscaling,因此我已在其上启用了 HPA,但它无法正常工作。它无法从指标服务器获取指标。低于错误。有人可以帮我吗?

Events:
  Type     Reason                        Age                  From                       Message
  ----     ------                        ----                 ----                       -------
  Warning  FailedGetResourceMetric       12m (x2 over 13m)    horizontal-pod-autoscaler  unable to get metrics for resource cpu: no metrics returned from resource metrics API
  Warning  FailedComputeMetricsReplicas  12m (x2 over 13m)    horizontal-pod-autoscaler  failed to get cpu utilization: unable to get metrics for resource cpu: no metrics returned from resource metrics API
  Warning  FailedComputeMetricsReplicas  10m (x10 over 12m)   horizontal-pod-autoscaler  failed to get cpu utilization: missing request for cpu
  Warning  FailedGetResourceMetric       3m5s (x39 over 12m)  horizontal-pod-autoscaler  missing request for cpu

【问题讨论】:

  • 您是如何创建HPA 的?使用推荐或 YAML 清单?您是否根据 K8s 文档创建它:kubernetes.io/docs/tasks/run-application/…
  • 嗨,我已经使用链接“@ 987654322@".
  • 1.提供$ kubectl describe hpa 的输出。 2.提供$ kubectl describe deployment <your-deployment-name>的输出,您可以编辑问题并将其发布到那里以获得更好的可见性。 3. 您使用的 AKS 群集版本是什么? 4. HPA 有时需要几分钟来应用所有内容。大约 10 分钟后您还有问题吗?
  • 您是否在 AKS 中启用了自动缩放功能?

标签: kubernetes azure-aks


【解决方案1】:

首先,通过应用these YAML files 来安装Metrics Server

验证安装是否成功:

kubectl get --raw=/apis/metrics.k8s.io/v1beta1

其次,确保你的 Deployment 的所有容器都有 CPU 资源请求:

apiVersion: apps/v1
kind: Deployment
<...>
    spec:
      containers:
      - image: foo
        name: foo
        resources:
          requests:
            cpu: 500m

第三,像你已经做的那样配置 Horizo​​ntal Pod Autoscaler 并观察事件。

【讨论】:

    猜你喜欢
    • 2022-07-05
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-03-28
    • 1970-01-01
    • 2020-06-01
    • 1970-01-01
    相关资源
    最近更新 更多