我已经在AKS
上创建了Azure
集群,并创建了一些部署。由于我的部署之一需要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
答案 0 :(得分:0)
首先,通过应用Metrics Server安装these YAML files。
验证安装是否成功:
kubectl get --raw=/apis/metrics.k8s.io/v1beta1
第二,确保部署中的所有容器都具有CPU资源请求:
apiVersion: apps/v1
kind: Deployment
<...>
spec:
containers:
- image: foo
name: foo
resources:
requests:
cpu: 500m
第三,按照已经配置的方式配置Horizontal Pod Autoscaler并观察事件。