Horizontal Pod Autoscaler (HPA) in Kubernetes manage the number of instances for each pod deployment based on the scale settings specified. Itw would be good insights to monitor the demand for scaling of each pod. as a prerequicite we need to setup monitoring AKS cluster with Managed Grafana in Azure with Azure Monitor and Log Analytics Workspace. Let's see how we can create a Grafana pannel to monitor the HPA behaviour over time.
The expected outcome is similar to below for a given deployment (pod HPA). Here max replicas setting shown in yellow line while green line shows desired number of replicase desired at each point in time, by the HPA based on the scale settings.
The query is as below to create the above panel. The variable aksservice used here to allow the user to sect the required deployment in the Grafana board so the panel can be used to see the required app deployment pod HPA scale counts.
The variable is defined in the Grafana board
The full json for Grafana panel is available in GitHub here. You can replace the id of the panel and the subscription, log analytics workspace name, resource group name etc.
The query is used in Grafana panel editor as shown below. You should select Azure Monitor as datasource and use Logs as Service. Then provide your log analaytics workspace for AKS as the resource.
No comments:
Post a Comment