Monitor a Kubernetes cluster with Operations Management Suite


You are viewing documentation for the old version of the Azure Container Service. Azure Container Service (AKS) is being updated to add new deployment options, enhanced management capabilities, and cost benefit to Kubernetes on Azure. Visit the AKS documentation to start working with these preview features.

Monitoring your Kubernetes cluster and containers is critical, especially when you manage a production cluster at scale with multiple apps.

You can take advantage of several Kubernetes monitoring solutions, either from Microsoft or other providers. In this tutorial, you monitor your Kubernetes cluster by using the Containers solution in Operations Management Suite, Microsoft's cloud-based IT management solution. (The OMS Containers solution is in preview.)

This tutorial, part seven of seven, covers the following tasks:

  • Get OMS Workspace settings
  • Set up OMS agents on the Kubernetes nodes
  • Access monitoring information in the OMS portal or Azure portal

Before you begin

In previous tutorials, an application was packaged into container images, these images uploaded to Azure Container Registry, and a Kubernetes cluster created.

If you have not done these steps, and would like to follow along, return to Tutorial 1 – Create container images.

Get Workspace settings

When you can access the OMS portal, go to Settings > Connected Sources > Linux Servers. There, you can find the Workspace ID and a primary or secondary Workspace Key. Take note of these values, which you need to set up OMS agents on the cluster.

Set up OMS agents

Here is a YAML file to set up OMS agents on the Linux cluster nodes. It creates a Kubernetes DaemonSet, which runs a single identical pod on each cluster node. The DaemonSet resource is ideal for deploying a monitoring agent.

Save the following text to a file named oms-daemonset.yaml, and replace the placeholder values for myWorkspaceID and myWorkspaceKey with your OMS Workspace ID and Key. (In production, you can encode these values as secrets.)

apiVersion: extensions/v1beta1
kind: DaemonSet
 name: omsagent
    app: omsagent
    agentVersion: v1.3.4-127
    dockerProviderVersion: 10.0.0-25
     - name: omsagent 
       image: "microsoft/oms"
       imagePullPolicy: Always
       - name: WSID
         value: myWorkspaceID
       - name: KEY 
         value: myWorkspaceKey
       - name: DOMAIN
         privileged: true
       - containerPort: 25225
         protocol: TCP 
       - containerPort: 25224
         protocol: UDP
        - mountPath: /var/run/docker.sock
          name: docker-sock
        - mountPath: /var/log 
          name: host-log
         - /bin/bash
         - -c
         - ps -ef | grep omsagent | grep -v "grep"
        initialDelaySeconds: 60
        periodSeconds: 60
    - name: docker-sock 
       path: /var/run/docker.sock
    - name: host-log
       path: /var/log

Create the DaemonSet with the following command:

kubectl create -f oms-daemonset.yaml

To see that the DaemonSet is created, run:

kubectl get daemonset

Output is similar to the following:

omsagent   3         3         3         0            3           <none>          5m

After the agents are running, it takes several minutes for OMS to ingest and process the data.

Access monitoring data

View and analyze the OMS container monitoring data with the Container solution in either the OMS portal or the Azure portal.

To install the Container solution using the OMS portal, go to Solutions Gallery. Then add Container Solution. Alternatively, add the Containers solution from the Azure Marketplace.

In the OMS portal, look for a Containers summary tile on the OMS dashboard. Click the tile for details including: container events, errors, status, image inventory, and CPU and memory usage. For more granular information, click a row on any tile, or perform a log search.

Containers dashboard in OMS portal

Similarly, in the Azure portal, go to Log Analytics and select your workspace name. To see the Containers summary tile, click Solutions > Containers. To see details, click the tile.

See the Azure Log Analytics documentation for detailed guidance on querying and analyzing monitoring data.

Next steps

In this tutorial, you monitored your Kubernetes cluster with OMS. Tasks covered included:

  • Get OMS Workspace settings
  • Set up OMS agents on the Kubernetes nodes
  • Access monitoring information in the OMS portal or Azure portal

Follow this link to see pre-built script samples for Container Service.