'Getting Unkown target for HPA

Am actually new to kubernetes, but as now am good with the terms such as deployment, pods etc. Well i was trying an example of HPA (Horizontal pod autoscaler), and as prerequisite metrics-servers is already integrated, but after all those things am not able to see HPA working as expected enter image description here When execute below cmd- Kubectl get hpa

Unknown in the target, although i have tried all my luck referring online forum but didn't got any break through Any help would be really appreciated

Thank you



Solution 1:[1]

Try this test

MENU > Kubernetes Engine> Workloads > Deploy > deploy the default nginx

MENU > Kubernetes Engine> Workloads > nginx deployment > actions > autoscale

The reason you might want to try this it so isolate the issue. If the above works then issue is with your file/setup. Usually everything default should work. If it fails then you have a bigger issue as in a GKE issue/version issue or metric server issue.

[This was not meant as an answer, i put it here as i did not have enough space to put in comments.]

Solution 2:[2]

I was getting same issue, fixed after adding cpu requests in my pod defination. Below points can be the reason in most of the cases

  • Metric server is not installed in your kubernates cluster, you can check with command (kubectl get deploy,svc -n kube-system | egrep metrics-server)
  • Check if you have provided resources for deployment/sts/pod definations

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1
Solution 2 Nikhil Lingam