Skip to content
This repository has been archived by the owner on Oct 24, 2023. It is now read-only.

Latest commit

 

History

History
92 lines (61 loc) · 5.81 KB

monitoring.md

File metadata and controls

92 lines (61 loc) · 5.81 KB

Monitoring Kubernetes Clusters

Monitoring your Kubernetes cluster lets you see its health and performance. Statistics such as CPU, memory, and disk usage are available for both Linux and Windows nodes in your AKS Engine cluster.

Resource metrics are collected by the lightweight, in-memory metrics-server component. Metrics-server discovers nodes and queries each one's kubelet for CPU and memory usage.

Metrics-server is part of every AKS Engine deployment. To verify that metrics-server is running in your cluster:

$ kubectl get pods --namespace=kube-system -l k8s-app=metrics-server
NAME                             READY   STATUS    RESTARTS   AGE
metrics-server-bb7db87bc-nm6vn   1/1     Running   2          140m

Tools like kubectl and the Kubernetes Dashboard use metrics-server, and it has an API to get metrics for your custom monitoring solution.

Monitoring Options

  1. kubectl
  2. Kubernetes Dashboard
  3. Azure Monitor for containers
  4. Monitoring extension

Kubectl

The kubectl top command is an easy way to see node or pod metrics in your terminal.

Use kubectl top node to see the resource consumption of nodes:

$ kubectl top node
NAME                                 CPU(cores)   CPU%   MEMORY(bytes)   MEMORY%
k8s-agentpool1-26399701-vmss000000   67m          3%     729Mi           10%
k8s-agentpool1-26399701-vmss000001   80m          4%     787Mi           10%
k8s-master-26399701-0                201m         10%    1406Mi          19%

Use kubectl top pod to see the resource consumption of pods:

$ kubectl top pod --namespace=kube-system
NAME                                            CPU(cores)   MEMORY(bytes)
azure-cni-networkmonitor-7gfd4                  2m           15Mi
...
kube-proxy-mzlq5                                1m           18Mi
kube-scheduler-k8s-master-26399701-0            3m           16Mi
metrics-server-bb7db87bc-nm6vn                  1m           12Mi

Kubernetes Dashboard

The Kubernetes Dashboard is a web-based user interface that can visualize cluster metrics.

Describing all of the useful ways to use the dashboard project is out of scope of this documentation. See here to learn more.

Azure Monitor for containers

Azure Monitor for containers is a feature designed to monitor the performance of container workloads. It supports self-managed Kubernetes clusters using AKS Engine.

Azure Monitor for containers gives you performance visibility by collecting memory and processor metrics from controllers, nodes, and containers that are available in Kubernetes through the Metrics API. Container logs are also collected. Please see its documentation overview for more detail.

Azure Monitor for containers is known as the "container-monitoring" addon in AKS Engine, and it is not enabled by default. See the container-monitoring docs to learn how to enable and configure Azure Monitor for containers via addon.

Alternately, you can install the azuremonitor-containers Helm chart to enable Azure Monitor for containers.

Once Azure Monitor for containers is enabled, navigate to https://aka.ms/azmon-containers to view the health, metrics, and logs of your AKS Engine clusters in the Azure portal website.

Refer to azuremonitor-containers-aks-engine for information about supported versions and for troubleshooting.

Image of Azure Monitor for containers

Please reach out with any questions or feedback by sending an email to Azure Monitor for containers.

Monitoring extension

A quick way to scaffold out cloud-native and open source monitoring components is to use the aks-engine monitoring extension. For details on how to use the monitoring extension, please refer to the extension documentation. By embedding the extension in your apimodel, the extension will do much of the work to create a monitoring solution in your cluster, which includes the following:

  • cAdvisor daemon set to publish container metrics
  • Prometheus for metrics collection and storage
  • Grafana for dashboard and visualizations

The extension wires up these components together. Post-deployment of the Kubernetes cluster, you just have to retrieve Grafana admin password (Kubernetes secret) and target your browser to the Grafana endpoint. There is already a pre-loaded Kubernetes cluster monitoring dashboard, so out-of-the-box you will have meaningful monitoring points with the extensibility that Prometheus and Grafana offer you.