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

标签 azure-aks

我已经成功部署了带有虚拟节点的 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,新创建的)。

这是否是虚拟节点的具体问题,即它们是否无法按照 autoscale 要求的方式通过 metrics-server 公开资源利用率?或者我还需要设置什么吗?

最佳答案

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

这是一个示例代码库,它表明可以使用 ACI 进行 HPA。

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

关于azure-aks - 具有虚拟节点和自动缩放功能的 Azure Kubernetes - 这可能吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56419261/

相关文章:

Azure AKS - oms 代理和诊断设置可以一起使用吗?

Azure 服务主体重置

azure - 为什么 'Azure Kubernetes Service RBAC Reader' 角色允许部署写入

azure - aks 上 azurefile 的 terraform kubernetes_storage_class

azure - 在 Docker 镜像内的 Jenkins (AKS) 上运行测试容器

azure - 错误: Rotate certificates in Azure Kubernetes Service (AKS)

azure - 如何使用 kubectl 获取 Azure 凭据?

Azure 应用程序网关入口 Controller - BackendHttpSettings 的数量超过允许的最大值 100

azure - 针对不同端口的 LoadBalancer Kubernetes

Azure Kubernetes - 用于命名空间隔离的 RBAC 角色