Daniel's Tech Blog

Cloud Computing, Cloud Native & Kubernetes

Monitor Azure Kubernetes Service with Azure Monitor container health

On Monday at Build Microsoft has announced a new monitoring solution Azure Monitor container health for AKS.

-> https://azure.microsoft.com/en-us/blog/kubernetes-on-azure/

Azure Monitor container health is based on Azure Monitor, Azure Log Analytics and the Container Insights solution, and is integrated into the Azure portal experience.

akscontainerhealth01

As you may know there is also the container monitoring solution. I have written about it in this article.

-> https://www.danielstechblog.io/configuring-and-deploying-the-container-monitoring-solution-for-aks-managed-kubernetes-on-azure/

You can continue to use the container monitoring solution, though the general recommendation is to use Azure Monitor container health for AKS and the container monitoring solution for Docker Swarm, DC/OS, OpenShift, ACS Engine-based clusters or other Docker-based installations like a single VM with Docker installed.

The Azure Monitor container health solution has a very clear panel to indicate resource consumption, operating and deployment issues. For deeper analysis you can directly jump into a log search on Log Analytics via View Logs.

akscontainerhealth02

As an example, I am showing the log output of a pod on my AKS cluster.

akscontainerhealth03akscontainerhealth04

I can use the integrated log search in the Azure portal or for further query customization the Azure Log Analytics portal.

After setting the basics, let us talk about deploying the Azure Monitor container health solution.

The easiest part for new AKS clusters is to use the portal experience.

akscontainerhealth05

You only need to turn on “Enable container monitoring” and select a Log Analytics workspace or create a new one.

In the backend the AKS Resource Provider together with the Azure Resource Manager deploys the OMS agent daemonset on the AKS cluster under the kube-system namespace.

akscontainerhealth07

No need to have to do this afterwards as with the container monitoring solution.

-> https://www.danielstechblog.io/configuring-and-deploying-the-container-monitoring-solution-for-aks-managed-kubernetes-on-azure/

The other alternative for new AKS clusters is using Azure Resource Manager templates. First use the following one to create an Azure Log Analytics workspace with the Container Insights solution.

-> https://github.com/neumanndaniel/armtemplates/blob/master/operationsmanagement/aksMonitoringSolution.json

az group deployment create --resource-group monitoring --template-uri https://raw.githubusercontent.com/neumanndaniel/armtemplates/master/operationsmanagement/aksMonitoringSolution.json --parameters workspaceName=aksMonitoring --verbose

Afterwards kick off the AKS deployment.

-> https://github.com/neumanndaniel/armtemplates/blob/master/container/aks.json

az group deployment create --resource-group aks --template-uri https://raw.githubusercontent.com/neumanndaniel/armtemplates/master/container/aks.json --parameters clusterName=aksCluster agentCount=3 agentVmSize=Standard_B2s linuxAdminUsername=azureuser sshRsaPublicKey=REDACTED servicePrincipalClientId=REDACTED servicePrincipalClientSecret=REDACTED kubernetesVersion=1.9.6 aksRegion=westeurope workspaceName=aksMonitoring workspaceResourceGroup=monitoring --verbose

akscontainerhealth06

When you have existing AKS clusters and you want to use the new monitoring solution, use the following ARM template to onboard them. Assuming you already have a Log Analytics workspace in place.

-> https://github.com/neumanndaniel/armtemplates/blob/master/container/aksEnableMonitoring.json

az group deployment create --resource-group aks --template-uri https://raw.githubusercontent.com/neumanndaniel/armtemplates/master/container/aksEnableMonitoring.json --parameters clusterName=aksCluster workspaceName=aksMonitoring workspaceResourceGroup=monitoring --verbose

Currently, you can only use the methods mentioned above for the Azure Monitor container health deployment.

For further details about Azure Monitor container health have a look at the Azure documentation.

-> https://docs.microsoft.com/en-us/azure/monitoring/monitoring-container-health

WordPress Cookie Notice by Real Cookie Banner