Enabling Azure Monitor support for AKS using the CLI

Enabling Azure Monitor for AKS clusters gives you performance visibility by collecting memory and processor metrics from controllers, nodes, and containers that are available in Kubernetes through the Kubernetes Metrics API.

 In this recipe, we will enable monitoring from AKS Kubernetes clusters to collect metrics and logs through a containerized version of the Log Analytics agent:

  1. If you have deployed your AKS cluster following the Provisioning a managed Kubernetes Cluster on AKS recipe in Chapter 1, Building Production-Ready Kubernetes Clusters, you can use the following command to enable the Azure Monitor for your cluster. Replace the name AKSCluster with your AKS cluster name, and replace the resource group, k8sdevopscookbook, with the Azure resource group name you used when you created your cluster before you run the following command:
$ az aks enable-addons -a monitoring 
--name AKSCluster --resource-group k8sdevopscookbook
If you are deploying a new cluster, you can add the --enable-addons monitoring parameter to the CLI command to enable Azure Monitor functionality for your AKS cluster during the cluster creation as follows:

$ az aks create --resource-group k8sdevopscookbook
--name AKSCluster
--node-count 3
--service-principal <appId>
--client-secret <password>
--enable-addons monitoring 
--generate-ssh-keys

When completed, this command will enable Azure Monitor and logs for your AKS cluster.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.117.229.44