I have created AKS
cluster on Azure
and created some deployments. Since one of my deployment required autoscaling
i have enabled HPA on it, but it is not working. It is unable to get metrics from metrics server. Getting below error. Can some one help me on it?
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
First, install the Metrics Server by applying these YAML files.
Verify that the installation succeeded with:
kubectl get --raw=/apis/metrics.k8s.io/v1beta1
Second, make sure that all the containers of your Deployment have CPU resource requests:
apiVersion: apps/v1
kind: Deployment
<...>
spec:
containers:
- image: foo
name: foo
resources:
requests:
cpu: 500m
Third, configure the Horizontal Pod Autoscaler as you already did and observe the events.