Azure Kubernetes Service (AKS) with Different Monitoring Solutions

Prometheus

Firstly, we would need to install Prometheus on AKS cluster to have the scrapped information from each resource. This article already provides detailed step-by-step guidance. As the installation process requires HELM v3, please follow the official site or this site to complete HELM v3 installation.

# check HELM version
- helm version
# check whether the namespace for Prometheus is created
- kubectl get ns
# install Prometheus through HELMv3
# check all services in monitoring namespace
- kubectl get svc -n monitoring
# save Prometheus service IP address into variable "SVC_IP"
- SVC_IP=$(kubectl get svc --namespace monitoring -l "app=prometheus,component=server" -o jsonpath="{.items[0].spec.clusterIP}")
# check the variable "SVC_IP"
- echo $SVC_IP

Grafana

After installing Prometheus (with the same article), we could install Grafana in the same monitoring namespace.

# get Grafana's Pod name
- export POD_NAME=$(kubectl get pods --namespace monitoring -l "app.kubernetes.io/name=grafana,app.kubernetes.io/instance=grafana " -o jsonpath="{.items[0].metadata.name}")
# Option 1: port forward Grafana's service to local machine's port
- kubectl --namespace monitoring port-forward $POD_NAME 3000
# Option 2: check whether Grafana's service could be changed into Load Balancer, so external clients could use public IP address to access the service
- kubectl get svc -n monitoring | grep grafana
# get the secret in monitoring namespace. The naming convention should be "grafana"
- kubectl get secret -n monitoring
# decode base64 to get the actual password for logging in Grafana dahshboard
- kubectl get secret -n monitoring grafana -o jsonpath="{.data.admin-password}" | base64 --decode ; echo

Azure Monitor

All the setup would be the same as above besides the fact that we would use Azure Log Analytics Workspace as data source instead of Prometheus. This article provides step-by-step guidance.

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Jonathan

Jonathan

Learning new things about Kubernetes every day. Hopefully, the learning notes could help people on the same journey!