📖 Scenario: You are managing an Azure Kubernetes Service (AKS) cluster for a small company. You want to monitor the cluster's health and performance using Azure Monitor's Container Insights. This will help you see how your containers are running and catch problems early.
🎯 Goal: Set up Container Insights monitoring on an AKS cluster by creating a resource group, enabling monitoring with Azure CLI commands, and then verifying the monitoring status.
📋 What You'll Learn
Create an Azure resource group named monitoring-rg in the eastus region
Create an AKS cluster named myAKSCluster in the monitoring-rg resource group
Enable Container Insights monitoring on the AKS cluster using Azure CLI
Verify the monitoring addon is enabled on the AKS cluster
💡 Why This Matters
🌍 Real World
Monitoring AKS clusters with Container Insights helps keep applications healthy and performant by providing real-time metrics and logs.
💼 Career
DevOps engineers and cloud administrators use these skills to maintain Kubernetes clusters and ensure smooth operations in production.
Progress0 / 4 steps
1
Create Azure Resource Group
Use the Azure CLI command az group create to create a resource group named monitoring-rg in the eastus region.
Azure
Hint
Remember to use the exact resource group name monitoring-rg and location eastus.
2
Create AKS Cluster
Use the Azure CLI command az aks create to create an AKS cluster named myAKSCluster in the resource group monitoring-rg. Use --generate-ssh-keys to create SSH keys automatically.
Azure
Hint
Make sure to use the exact cluster name myAKSCluster and resource group monitoring-rg.
3
Enable Container Insights Monitoring
Enable Container Insights monitoring on the AKS cluster myAKSCluster in resource group monitoring-rg using the Azure CLI command az aks enable-addons with the addon name monitoring.
Azure
Hint
Use the exact addon name monitoring to enable Container Insights.
4
Verify Monitoring Addon Status
Use the Azure CLI command az aks show with --resource-group monitoring-rg and --name myAKSCluster to check if the monitoring addon is enabled. Then print the addonProfiles section from the output.
Azure
Hint
Use --query addonProfiles to filter the output to the addons section.
Practice
(1/5)
1. What is the primary purpose of enabling Container Insights on an AKS cluster?
easy
A. To increase the number of nodes in the cluster automatically
B. To deploy applications faster on AKS
C. To monitor the health and performance of the AKS cluster
D. To secure the AKS cluster with firewall rules
Solution
Step 1: Understand Container Insights role
Container Insights is designed to collect and display health and performance data for AKS clusters.
Step 2: Compare options with Container Insights function
Only monitoring health and performance matches Container Insights' purpose; other options relate to scaling, deployment, or security.
Final Answer:
To monitor the health and performance of the AKS cluster -> Option C
Quick Check:
Container Insights = Monitoring AKS health [OK]
Hint: Container Insights is about monitoring, not scaling or security [OK]
Common Mistakes:
Confusing monitoring with scaling features
Thinking it deploys apps faster
Assuming it manages security rules
2. Which Azure CLI command correctly enables Container Insights monitoring on an existing AKS cluster named myCluster in resource group myGroup?
easy
A. az aks update --enable-monitoring --name myCluster --resource-group myGroup
B. az aks enable-addons --addons monitoring --name myCluster --resource-group myGroup
C. az aks create --addons monitoring --name myCluster --resource-group myGroup
D. az monitor enable --resource-group myGroup --name myCluster
Solution
Step 1: Identify the correct command to enable addons
The command to enable addons on an existing AKS cluster is az aks enable-addons with the --addons monitoring flag.
Step 2: Verify command syntax and parameters
az aks enable-addons --addons monitoring --name myCluster --resource-group myGroup uses the correct command and parameters: cluster name and resource group are specified properly.
Final Answer:
az aks enable-addons --addons monitoring --name myCluster --resource-group myGroup -> Option B
Quick Check:
Enable addons command = az aks enable-addons --addons monitoring --name myCluster --resource-group myGroup [OK]
Hint: Use 'az aks enable-addons' with '--addons monitoring' [OK]
Common Mistakes:
Using 'az aks create' instead of enable-addons
Trying 'az aks update' with wrong flags
Confusing Azure Monitor commands with AKS commands
3. After enabling Container Insights on your AKS cluster, you run this command:
az aks show --name myCluster --resource-group myGroup --query addonProfiles
What output indicates that monitoring is enabled?
medium
A. {"omsagent": {"enabled": true}}
B. {"monitoring": {"status": "active"}}
C. {"containerInsights": {"enabled": false}}
D. {"omsagent": {"enabled": false}}
Solution
Step 1: Understand addonProfiles output for monitoring
The monitoring addon in AKS is called 'omsagent'. When enabled, its 'enabled' property is true.
Step 2: Match output with enabled monitoring
{"omsagent": {"enabled": true}} shows 'omsagent' with 'enabled': true, indicating monitoring is active.
Final Answer:
{"omsagent": {"enabled": true}} -> Option A
Quick Check:
omsagent enabled = true means monitoring active [OK]
Hint: 'omsagent' enabled true means Container Insights is on [OK]
Common Mistakes:
Looking for 'monitoring' or 'containerInsights' keys instead of 'omsagent'
Confusing enabled false as active
Misreading JSON structure
4. You enabled monitoring on your AKS cluster but do not see any logs or metrics in Azure Monitor. Which of the following is the most likely cause?
medium
A. Container Insights only works with Windows nodes, not Linux
B. The AKS cluster nodes are running an unsupported Kubernetes version
C. The Azure CLI command used was missing the --resource-group parameter
D. The Log Analytics workspace was not linked or created during monitoring setup
Solution
Step 1: Identify key requirement for Container Insights data
Container Insights requires a Log Analytics workspace to collect and store logs and metrics.
Step 2: Analyze why no data appears
If the workspace was not linked or created, no data will flow to Azure Monitor, causing empty logs and metrics.
Final Answer:
The Log Analytics workspace was not linked or created during monitoring setup -> Option D
Quick Check:
Missing workspace = no logs in Azure Monitor [OK]
Hint: Check Log Analytics workspace linkage if no monitoring data shows [OK]
Common Mistakes:
Assuming Kubernetes version blocks monitoring data
Thinking missing CLI parameters always cause no data
Believing Container Insights only supports Windows nodes
5. You want to set up alerts in Azure Monitor for your AKS cluster using Container Insights to notify you when CPU usage exceeds 80% for 5 minutes. Which steps should you follow?
hard
A. Create a Log Analytics query for CPU usage, then create an alert rule based on that query with a 5-minute evaluation period
B. Enable monitoring with az aks enable-addons, then configure alerts directly in AKS cluster settings
C. Install a custom agent on each node to send CPU metrics, then configure alerts in Azure Monitor
D. Use Azure CLI to scale the cluster automatically when CPU exceeds 80%
Solution
Step 1: Use Log Analytics to query CPU metrics
Container Insights sends metrics to Log Analytics, where you can write queries to analyze CPU usage.
Step 2: Create an alert rule in Azure Monitor
Set an alert rule using the query with a condition for CPU > 80% sustained over 5 minutes to trigger notifications.
Final Answer:
Create a Log Analytics query for CPU usage, then create an alert rule based on that query with a 5-minute evaluation period -> Option A
Quick Check:
Alerts need queries + rules in Azure Monitor [OK]
Hint: Use Log Analytics queries to create alerts in Azure Monitor [OK]
Common Mistakes:
Thinking alerts are configured directly in AKS without Azure Monitor
Assuming custom agents are needed for CPU metrics
Confusing scaling actions with alert setup
Recommended
Ready to prove it?
Pass the test and this pattern moves unknownstrongwhile earning +1 Grip toward your certificate.