Skip to main content

Posts

Showing posts from November 15, 2019

Horizontal Pod Autoscale & Metrics Server installation in K8S

In K8s inorder to create the HPA we just need to give a below kubectl command like below: # kubectl autoscale deployment myapp  --min=1 --max=4 --cpu-percent=80 But this will give a series of errors like below if metrics API is not registered. ######################################## ubuntu@namenode:~$ kubectl get hpa NAME           REFERENCE                 TARGETS         MINPODS   MAXPODS   REPLICAS   AGE myapp   Deployment/myapp   < unknown> /80%   1         4         2          43h ubuntu@namenode:~$ kubectl describe horizontalpodautoscaler.autoscaling/myapp | grep Warning   Warning  FailedComputeMetricsReplicas  32m (x10333 over 43h)   horizontal-pod-autoscaler  invalid metrics (1 invalid out of 1), first error is: failed to get cpu utilization: unable to get metrics for resource cpu: unable to fetch metrics from resource metrics API: the server could not find the requested resource (get pods.metrics.k8s.io)   Warning  FailedGetResourceMetric       2m7s (x1