Kubernetes Deep Dive

Sign Up Free or Log In to participate!

Autosclaling hpa target don’t change from [ <unknow</50% ] after deploy it.

 Can anyone help me please. Begginer here in kubernetes.

nigelpoulton

Hi Diogo. Thanks for taking the course. I'll need a lot more info if I've got any chance of helping... :-(

laughk

Hi Nigel, not sure if Diego is having the same issue, but I just hit this issue doing some testing on my cluster (non-cloud k8s cluster). Looking at the logs and investigating a few things I get the same errors if I use the file in the class resources or if I use my modified YAML file with different values:

laughk

Conditions: 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: unable to fetch metrics from resource metrics API: the server could not find the requested resource (get pods.metrics.k8s.io) Events: Type Reason Age From Message ---- ------ ---- ---- ------- Warning FailedGetResourceMetric 9s (x2 over 24s) horizontal-pod-autoscaler 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 FailedComputeMetricsReplicas 9s (x2 over 24s) horizontal-pod-autoscaler 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)

laughk

That didn't format awesome, but let me know if there is a better way to send/post the logs. I can't hit that apiservice location manually so I am not sure if there is maybe a dependancy that should be running in the cluster (maybe it runs automatically in the GKE clusters and has to be installed or setup with onprem clusters?) I'll continue to investigate, but since I saw this as I hit it, I figured I would share and see if you had any thoughts. Thanks!

1 Answers

Hi Deigo, The issue seems to be caused by the fact that there is a dependency needed for HPA to run on the cluster running the metrics-server. I had this in my setup (non-cloud bare metal) and once I installed this, the HPA was able to accurately identify the current usage:

https://github.com/kubernetes-incubator/metrics-server

One note I will make is that after initially installing the metrics-server, I had errors being unable to collect metrics and that forced me to tweak the deployment file and add these to metric-server-deployment.yaml file:

command:

  • /metrics-server

  • --kubelet-insecure-tls

  • --kubelet-preferred-address-types=InternalIP

This is noted here: https://github.com/kubernetes-incubator/metrics-server/issues/131

Once I deleted the metric-server, tweaked the YAML file, and re-deployed, it all worked fine and showed my current usage metrics. Hope this helps. 

-Keith

Smj

I'm having this same issue, deploying exactly as per the video the HPA is stuck at <unknown>/50%. As it's not mentioned in the training material I wouldn't have thought that it would be required? @nigelpoulton - Can you confirm?

Smj

garh - sorry for the formatting, this forum software is pretty poor.

Sign In
Welcome Back!

Psst…this one if you’ve been moved to ACG!

Get Started
Who’s going to be learning?