Use Azure Monitor for containers on Azure Stack Hub

You can use Azure Monitor for containers to monitor your containers in an AKS engine deployed Kubernetes cluster in Azure Stack Hub.

Important

Azure Monitor for containers on Azure Stack Hub is currently in public preview. This preview version is provided without a service level agreement, and it's not recommended for production workloads. Certain features might not be supported or might have constrained capabilities. For more information, see Supplemental Terms of Use for Microsoft Azure Previews.

You can review container performance with Azure Monitor by collecting memory and processor metrics from controllers, nodes, and containers available in Kubernetes through the Metrics API. In addition, the service collects container logs. You can use these logs to diagnose issues in your on-premises cluster from Azure. After you set up monitoring from your Kubernetes clusters, these metrics and logs are automatically gathered. A containerized version of the Azure Monitor Log Analytics agent for Linux gathers the logs. Azure Monitor stores the metrics and logs in your log analytics workspace accessible in your Azure subscription.

There are two ways to enable Azure Monitor on your cluster. Both ways require you to set up an Azure Monitor Log Analytics workspace in Azure.

Prerequisites

Both methods require the pre-requisites listed in the Azure Monitor - Containers.

Method one

You can also use the Helm chart to install the monitoring agents in your cluster. Follow the instructions in the following article, Azure Monitor - Containers.

Method two

You can specify an addon in the AKS engine cluster specification json file. The file is also called the API Model. In this addon, provide the base64 encoded version of WorkspaceGUID and WorkspaceKey of the Azure Log Analytics Workspace where the monitoring information will be stored.

Supported API definitions for the Azure Stack Hub cluster can be found in this example: kubernetes-container-monitoring_existing_workspace_id_and_key.json. Specifically, find the addons property in kubernetesConfig:

 "orchestratorType": "Kubernetes",
       "kubernetesConfig": {
         "addons": [
           {
             "name": "container-monitoring",
             "enabled": true,
             "config": {
               "workspaceGuid": "<Azure Log Analytics Workspace Guid in Base-64 encoded>",
               "workspaceKey": "<Azure Log Analytics Workspace Key in Base-64 encoded>"
             }
           }
         ]
       }

Next steps