Skip to main content Link Menu Expand (external link) Document Search Copy Copied

Configure AKS monitoring

Point in time info on your kubernetes resources is nice, however, it is also beneficial to have overall monitoring data available. For this you can enable Container Insights in your cluster. It includes collection of telemetry critical for monitoring, analysis and visualization of collected data to identify trends, and how to configure alerting to be proactively notified of critical issues.

Enable Container Insights on your AKS cluster. You can follow the below guidance to do so.

Step by step guidance

  1. In your bash shell, create a Log Analytics workspace.

    WORKSPACE=la-$APPNAME-$UNIQUEID
    az monitor log-analytics workspace create \
        --resource-group $RESOURCE_GROUP \
        --workspace-name $WORKSPACE
    
  2. add the Container Insights add-on to your AKS cluster.

    WORKSPACEID=$(az monitor log-analytics workspace show -n $WORKSPACE -g $RESOURCE_GROUP --query id -o tsv)
       
    az aks enable-addons \
        -a monitoring \
        -n $AKSCLUSTER \
        -g $RESOURCE_GROUP \
        --workspace-resource-id $WORKSPACEID
    
  3. You can verify whether the monitoring agent got deployed correctly with the below statement.

    kubectl get ds ama-logs --namespace=kube-system
    
  4. To verify that monitoring data is available in your Log Analytics workspace, in your browser, navigate to your AKS cluster in the Azure Portal. Select Insights. You can inspect here the monitoring data in your cluster. If you turn on Live mode you will see the data coming in.

    Azure Monitor managed service for Prometheus is an alternative way for monitoring your kubernetes resources. You can find more info at Collect Prometheus metrics from AKS cluster. This can then be visualized by Azure Managed Grafana.