我已经成功部署了带有虚拟节点的 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。
关于azure-aks - 具有虚拟节点和自动缩放功能的 Azure Kubernetes - 这可能吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56419261/