Kubernetes Deep Dive

Sign Up Free or Log In to participate!

HPA cannot locate metrics server on Docker For Windows or on Minikube

Hi Nigel!

I’m Getting the following on the HPA in both Docker For Windows and in Minikube:

$ kubectl describe hpa --namespace acg-ns  
Name: acg-hpa  
Namespace: acg-ns  
Labels:   
Annotations: kubectl.kubernetes.io/last-applied-configuration:  
{"apiVersion":"autoscaling/v1","kind":"HorizontalPodAutoscaler","metadata":{"annotations":{},"name":"acg-hpa","namespace":"acg-ns"},"spec"...  
CreationTimestamp: Wed, 17 Oct 2018 09:55:28 -0400  
Reference: Deployment/acg-web  
Metrics: ( current / target )  
resource cpu on pods (as a percentage of request):  / 50%  
Min replicas: 1  
Max replicas: 10  
Deployment pods: 1 current / 0 desired  
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 26s (x2 over 56s) 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 26s (x2 over 56s) 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)

Any idea how I can continue locally with this lab?

nigelpoulton

Hi Philip. I’m out at the moment, but will take a look at this when I’m home. Sounds like the metrics server might not be running, but I’m thinking out loud and will take a proper look later!

nigelpoulton

Can you try deploying the metrics server from this link – you might need to deploy it from the YAML files (i think there’s a link). https://kubernetes.io/docs/tasks/debug-application-cluster/core-metrics-pipeline/

1 Answers

Hi philiplavoie.

I’ve had a hack around with this morning and it’s not good. 

HPAs use either heapster or the metrics server for gathering metrics. heapster is being deprecated and replaced by metrics server.

However, it looks like Docker Desktop doesn’t ship with either. I’ve had a go at manually configuring the metrics server, but it looks like Docker Desktop might have some TLS or RBAC quirks that stop it from working.

This is a disappointment, as the goal of Docker Desktop is to create a local dev experience that closely matches prod. But not shipping heapster or metrics server creates a huge discrepancy with prod. I’ve given up trying to resolve this, as a hacky solution is not a good solution for a video course like this. Also, it’s the type of thing that might change in future releases of Docker Desktop etc.

I 100% agree that this is not ideal but you can follow along on GKE and you can probably do it for free using free credits etc.

I’m gutted that I don’t have a better solution. Unfortunately this one’s out of my control.

philiplavoie

Ah! Thank you sir. Yeah, I was able to install it, but it’s failing to connect. We’ve probably been through the same issues. 😉 Will switch to GKE for this one and keep rolling. Thanks a mil!

Sign In
Welcome Back!

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

Get Started
Who’s going to be learning?