How to use Azure monitor metrics with Horizontal Pod Autiscaler ?

Amarkumar Mishra - FT 21 Reputation points
2022-05-23T12:04:14.163+00:00

I am pushing a custom metric to Azure Monitor using Azure Monitor REST API. Now I wanted to use this custom metric present on Azure Monitor with Horizontal Pod Autoscaler to trigger scaling of pods. But I am not understanding how to configure HPA to use the above custom metric. I also went through Azure documentation where they are suggesting to use Azure Kubernetes Metric Adapter, but when I am trying to add it in my cluster I am getting this error

error: unable to recognize "https://raw.githubusercontent.com/Azure/azure-k8s-metrics-adapter/master/deploy/adapter.yaml": no matches for kind "Deployment" in version "apps/v1beta2"  
  

Let me know how I can configure HPA to use custom metric present on Azure Monitor.

Azure Monitor
Azure Monitor
An Azure service that is used to collect, analyze, and act on telemetry data from Azure and on-premises environments.
2,968 questions
Azure Kubernetes Service (AKS)
Azure Kubernetes Service (AKS)
An Azure service that provides serverless Kubernetes, an integrated continuous integration and continuous delivery experience, and enterprise-grade security and governance.
1,961 questions
Azure ISV (Independent Software Vendors) and Startups
Azure ISV (Independent Software Vendors) and Startups
Azure: A cloud computing platform and infrastructure for building, deploying and managing applications and services through a worldwide network of Microsoft-managed datacenters.ISV (Independent Software Vendors) and Startups: A Microsoft program that helps customers adopt Microsoft Cloud solutions and drive user adoption.
91 questions
0 comments No comments
{count} votes

Accepted answer
  1. AnuragSingh-MSFT 21,236 Reputation points
    2022-05-24T04:34:00.027+00:00

    @Amarkumar Mishra - FT , thank you for the question.

    The error being received seems to be due to deprecated APIs removed in 1.16+ version of Kubernetes. For more details please refer to: Deprecated APIs Removed In 1.16: Here’s What You Need To Know

    To fix this, you will have to change apiVersion: apps/v1beta2 to apiVersion: apps/v1.
    The referred yaml file in the doc points to an archived repository: Azure/azure-k8s-metrics-adapter and corresponding issue filed for it is available here: Deploying to k8s 1.16.7 fail

    You may copy the content of this yaml file to your local machine, make the api version change and apply. Please let me know if changing the API version as recommended above helps. I am also reaching out to our team to get the Azure doc updated.

    1 person found this answer helpful.
    0 comments No comments

0 additional answers

Sort by: Most helpful