I will explain easy and comprehensive way to install and setup Prometheus and Grafana in AKS (Azure Kubernetes Service). In Kubernetes eco-system, the monitoring and alerting get handled by Prometheus and Grafana. The main purpose of Prometheus is to gather monitoring logs, but it is not user-friendly to visualize data in Prometheus. Grafana is to help you visualize the log data because it is fairly easy to visualize log data in Grafana. One of the shortcomings of Grafana is that it cannot gather and store monitoring log data. Therefore, Prometheus and Grafana complement each other and usually work together in Kubernetes environment.
1. Prerequisites
a. Windows Environment (10 or 11)
b. Azure CLI
Installation instructions are listed below: https://learn.microsoft.com/en-us/cli/azure/install-azure-cli-windows?tabs=azure-cli
c. chocolatey
chocolatey is a tool for PowerShell that lets you install various tools or plugins. The link below has instructions and also I have separately explained it below the link: https://chocolatey.org/install
chocolatey instructions 1. Open PowerShell (run as Administrator !!!!) 2. Enter the command below:
3. If the return value is Restricted, then enter ONE of the following commands below. If the return value is NOT Restricted, then skip to the next step.
4. Install chocolatey using the following command:
d. helm & base64
helm and base64 can be easily installed by chocolatey using the commands below:
helm - https://github.com/helm/helm
2. Instructions
a. Open PowerShell
b. Set Azure login and subscription using Azure CLI
c. Download kubectl account information
d. Install Prometheus and Grafana
Enter each command below in PowerShell
If you did not have any errors, it is all set. Please keep in mind that your namespace and service names may be different if you set different names during the installation.
3. Accessing Prometheus and Grafana After Installation
In a production environment, you will use Public ID and DNS to access them. In a dev environment, you will use Port Forwarding and use localhost in a browser. Please keep in mind that your namespace and service names may be different if you set different names during the installation.
a. Prometheus
By entering the command below in PowerShell, you can access it on your browser, located at localhost:9090
b. Grafana
Entering the command below, you can access Grafana using your browser, located at localhost:3000. However, you need Grafana's admin user account information when accessing it (shown in the code block below).
You must change Grafana's admin password after the first login. It is possible in Grafana's GUI.