Enable Azure Monitor¶
This guide will walk you through enabling Azure Monitor to collect logs and metrics from your AKS Cluster.
Fast Forward
If you already have enabled Azure Monitor for your AKS cluster, expand this box to fast-forward.
- Proceed to the Verify section.
See also
- Official guide on Azure Monitor.
- Official guide to Query logs from Container Insights.
- Official document on AKS Monitoring Architecture.
Overview
What You’ll Need¶
- A configured management environment.
- An existing AKS cluster.
Procedure¶
Go to your
rok-toolsmanagement environment and enable themonitoringAKS add-on:root@rok-tools:~# az aks enable-addons --addon monitoring \ > --resource-group ${AZ_RESOURCE_GROUP?} --name ${AKS_CLUSTER?}
Verify¶
Ensure the
monitoringadd-on is enabled in your AKS cluster. Verify that the output of the following command is true:root@rok-tools:~# az aks show --resource-group ${AZ_RESOURCE_GROUP?} \ > --name ${AKS_CLUSTER?} --query addonProfiles.omsagent.enabled trueEnsure that the
ama-logsDaemonSet is running in your AKS cluster. Verify that the number of DESIRED pods is equal to the number of READY pods:root@rok-tools:~# kubectl get ds ama-logs -n kube-system NAME DESIRED CURRENT READY UP-TO-DATE AVAILABLE NODE SELECTOR AGE ama-logs 5 5 5 5 5 <none> 28mTroubleshooting
The DaemonSet was not found
Depending on the region of your AKS cluster, the Azure Monitor DaemonSet may be deployed with a different name. In this case, the above command will fail with the following error:
Error from server (NotFound): daemonsets.apps "ama-logs" not foundIn this case, retrieve the
omsagentDaemonSet and perform the same verification:root@rok-tools:~# kubectl get ds omsagent -n kube-system NAME DESIRED CURRENT READY UP-TO-DATE AVAILABLE NODE SELECTOR AGE omsagent 5 5 5 5 5 <none> 28mEnsure that the
ama-logs-rsDeployment is running in your AKS cluster. Verify that the READY field is equal to 1/1:root@rok-tools:~# kubectl get deployment ama-logs-rs -n kube-system NAME READY UP-TO-DATE AVAILABLE AGE ama-logs-rs 1/1 1 1 2dTroubleshooting
The Deployment was not found
Depending on the region of your AKS cluster, the Azure Monitor Deployment may be deployed with a different name. In this case, the above command will fail with the following error:
Error from server (NotFound): deployments.apps "ama-logs-rs" not foundIn this case, retrieve the
omsagent-rsDeployment and perform the same verification:root@rok-tools:~# kubectl get deployment omsagent-rs -n kube-system NAME READY UP-TO-DATE AVAILABLE AGE omsagent-rs 1/1 1 1 2d
What’s Next¶
Check out the rest of the maintenance operations that you can perform on your cluster.