How to Install Grafana-Prometheus on Azure Kubernetes Service
--
AKS-Grafana-Prometheus-Azure-Helm
Hi everyone,
I’ll show you how to install the grafana-prometheus stack for existing AKS in this article.
Let’s begin by importing the helm repo into our Azure DevOps repository. Because of versions and changes, we must import the existing version into our own repository to avoid problems later.
Import → https://github.com/prometheus-community/helm-charts/tree/main
This process may take some time.
When this process is complete, you will be able to select the main branch by default. Because we’ll be following the main branch.
Now it’s time to create our azure-pipelines yaml file!
Pipelines → Create Pipeline
Azure Repos Git →
Prometheus Community →
Starter Pipeline →
Now we can edit the pipeline. Make sure that you have a connection for AKS.
First, we’ll create a namespace called monitoring. Let’s add it with the Kubernetes task.
- task: Kubernetes@1
inputs:
connectionType: 'Kubernetes Service Connection'
kubernetesServiceEndpoint: 'aks-connection'
command: 'create'
arguments: 'namespace monitoring'
Installing our chart with the helm is the next step.
- task: HelmDeploy@0
inputs:
connectionType: 'Kubernetes Service Connection'
kubernetesServiceConnection: 'aks-connection'
namespace: 'monitoring'
command: 'install'
chartType: 'FilePath'
chartPath: 'charts/kube-prometheus-stack'
releaseName: 'prometheus'
arguments: '--dependency-update'
The “ — dependency-update” argument is important here; because it also allows other dependencies to be installed.
Click the “Save&Run” button.
By default, the Grafana service uses ClusterIP. Change this to open our service from our repository.
Let’s make the following update to line 894 in the values.yaml file for charts/kube-prometheus-stack.
The upgrade task should now be added to our pipeline.
- task: HelmDeploy@0
inputs:
connectionType: 'Kubernetes Service Connection'
kubernetesServiceConnection: 'aks-connection'
namespace: 'monitoring'
command: 'upgrade'
chartType: 'FilePath'
chartPath: 'charts/kube-prometheus-stack'
releaseName: 'prometheus'
arguments: '--dependency-update'
The other 2 tasks can be disabled so that we can run the pipeline again.
As you can see, it has been upgraded.
Here, you may view the IP reserved for Grafana through the Azure Portal or via the pipeline.
The default username and password for Grafana are as follows:
username : admin
password : prom-operator
If you’d like, you can modify them on the chart.
After logging in, you can see that the Dashboards tab has a lot of dashboards already installed.
Here is our final YAML file:
trigger:
- none
pool:
vmImage: ubuntu-latest
steps:
- task: Kubernetes@1
enabled: false
inputs:
connectionType: 'Kubernetes Service Connection'
kubernetesServiceEndpoint: 'aks-connection'
command: 'create'
arguments: 'namespace monitoring'
- task: HelmDeploy@0
enabled: false
inputs:
connectionType: 'Kubernetes Service Connection'
kubernetesServiceConnection: 'aks-connection'
namespace: 'monitoring'
command: 'install'
chartType: 'FilePath'
chartPath: 'charts/kube-prometheus-stack'
releaseName: 'prometheus'
arguments: '--dependency-update'
- task: HelmDeploy@0
inputs:
connectionType: 'Kubernetes Service Connection'
kubernetesServiceConnection: 'aks-connection'
namespace: 'monitoring'
command: 'upgrade'
chartType: 'FilePath'
chartPath: 'charts/kube-prometheus-stack'
releaseName: 'prometheus'
arguments: '--dependency-update'
Hope you find my article helpful. I wish everyone an awesome day!