azurekubernetesazure-akskubernetes-metrics

how to make azure external.metrics.k8s adapter work?


I've setup Azure external metrics adapter following this document "https://github.com/Azure/azure-k8s-metrics-adapter/tree/master/samples/servicebus-queue"

After the helm installation using service-principal when executing the command kubectl get --raw "/apis/external.metrics.k8s.io/v1beta1" | jq I should be getting an output as suggested by the document. but instead I'm facing an error stating Error from server (ServiceUnavailable): the server is currently unable to handle the request

The helm installation went successful and below are the logs

I0116 12:49:36.216094 1 controller.go:40] Setting up external metric event handlers I0116 12:49:36.216148 1 controller.go:52] Setting up custom metric event handlers I0116 12:49:36.216528 1 controller.go:69] initializing controller I0116 12:49:36.353905 1 main.go:104] Looking up subscription ID via instance metadata I0116 12:49:36.359887 1 instancemetadata.go:40] connected to sub: ********************* I0116 12:49:36.416858 1 controller.go:77] starting 2 workers with 1000000000 interval I0116 12:49:36.417062 1 controller.go:88] Worker starting I0116 12:49:36.417068 1 controller.go:88] Worker starting I0116 12:49:36.417074 1 controller.go:98] processing item I0116 12:49:36.417078 1 controller.go:98] processing item I0116 12:49:36.680065 1 serving.go:312] Generated self-signed cert (apiserver.local.config/certificates/apiserver.crt, apiserver.local.config/certificates/apiserver.key) I0116 12:49:37.197936 1 secure_serving.go:116] Serving securely on [::]:6443

When I execute the command kubectl api-versions external.metrics.k8s.io/v1beta1 is displayed in the list. So this proves that the installation went successful. But why am I not able to hit the api???


Solution

  • Solved it. Initially I was installing in my custom namespace. Looks like Azure metrics adapter will work only if it is installed in namespace "custom-metrics". Probably they should mention it somewhere in the document. It cost me 2 days of trouble shooting to figure this out :-(