具有虚拟节点和自动缩放功能的Azure Kubernetes-这可能吗?

时间:2019-06-02 22:03:20

标签: azure-aks azure-kubernetes

我已经成功地在虚拟节点上部署了AKS,它会自动创建Azure容器实例以支持请求的Pod的数量,并且我可以手动扩展:

kubectl scale --replicas=20 deployment.apps/blah

当然,我可以看到在一个特殊的资源组中创建了20个容器实例,它们都在运行我的应用程序。当我按比例缩小时,它们消失了。太好了。

因此,我尝试设置自动缩放。我在Yaml中设置了CPU限制/请求,然后说:

kubectl autoscale deployment blah --min=1 --max=20 --cpu-percent=50

但是没有创建新的Pod。要了解更多信息,我说:

kubectl describe hpa

我得到:

  Type           Status  Reason                   Message
  ----           ------  ------                   -------
  AbleToScale    True    SucceededGetScale        the HPA controller was able to get the target's current scale
  ScalingActive  False   FailedGetResourceMetric  the HPA was unable to compute the replica count: unable to get metrics for resource cpu: no metrics returned from resource metrics API
Events:
  Type     Reason                        Age                  From                       Message
  ----     ------                        ----                 ----                       -------
  Warning  FailedGetResourceMetric       3s (x12 over 2m49s)  horizontal-pod-autoscaler  unable to get metrics for resource cpu: no metrics returned from resource metrics API
  Warning  FailedComputeMetricsReplicas  3s (x12 over 2m49s)  horizontal-pod-autoscaler  failed to get cpu utilization: unable to get metrics for resource cpu: no metrics returned from resource metrics API

According to these docs metrics-server自1.8起自动提供(在AKS中为1.12,新创建)。

这是虚拟节点的一个具体问题吗,即它们是否缺乏以metrics-server所要求的方式通过autoscale公开资源利用的能力?还是我需要设置其他内容?

1 个答案:

答案 0 :(得分:0)

Metric-Server应该能够从Virtual Kubelet(ACI)收集指标

下面是一个示例存储库,显示了具有ACI的HPA是可行的。

https://github.com/Azure-Samples/virtual-node-autoscale