Tanzu

 View Only

 How to enable Metric API on vSphere Tanzu?

Max Rad's profile image
Max Rad posted Sep 30, 2024 03:57 AM

Is that possible to enable Metric API from metric server for AutoScaling purposes?

by default this command did not work on vsphere tanzu kubernetes control planes and return Metrics API not available and thus we cannot add horizontal autoscaling on pods deployment.

$ kubectl top nodes
error: Metrics API not available

for enabling metric server I install that from  here: https://github.com/kubernetes-sigs/metrics-server

after facing some issues like cannot install that inside kube-system namespace, i install that inside new namespace and after all metric server goes up and get control planes metric and not worker nodes. their metrics is unknown. after some digging i found that metric server tries to scrape metric data from worker nodes that listens on port 10250 and this endpoint /metrics/resource . the problem is that to retrieve this data we need client certificate that must be provided during scrape...

$ kubectl top nodes
NAME     CPU(cores)   CPU%   MEMORY(bytes)   MEMORY%     
k8nod1   163m         8%     702Mi           9%          
k8nod2 164m 9% 712Mi 10%
k8nod3 165m 11% 742Mi 13% k8mas1 <unknown> <unknown> <unknown> <unknown> k8nod2 <unknown> <unknown> <unknown> <unknown>
k8nod3 <unknown> <unknown> <unknown> <unknown>

don't bothering you... is that another way exist for this purpose? what about mine way? in any other kubernetes solutions this work done, but in vsphere tanzu for restricted reasons that may not possible to achieve.

thanks.