Search code examples
azurekubernetesgrafanaazure-aks

Monitor the kubernetes services with grafana dash board-Azure


I have helm to install the git-hub repo for the grafana as shown in below

helm repo add Prometheus  Prometheus-community https://promentheus-community.github.io/helm-charts
helm install Prometheus-community/kube-Prometheus-stack -n Prometheus
kubectl get namespaces

After that I have configured the grafana it will work on port 9090, I have exposed to 9090 using port-forward command,

When I open the browser with localhost:9090 I am not able to see any grafana page, its showing ERR_CONECTION error/Localhost refused to connect, After some time when I refresh again now I am able to see the grafana page

Everything works fine till now after that I am trying to open the grafana dashboard to monitor the logs it is asking admin user name credentials but I did not mention any credentials but it is asking

My questions are

1). How to login with grafana to monitor the logs and also I want to import the azure monitor metrics to check in the grafana dashboard

2). Is any thing do we need to add role based polices or service principal we have to add to login the grafana

Can any one help me how to login the grafana dashboard to monitor the logs

Thanks in advance

My grafana page is look like

this


Solution

  • I tried to reproduce the same issue in m environment and got the below results

    For login into the Grafana dashboard we don't need to assign the service principal or role based polices , if we want to get the metrics into the Grafana dashboard than only we have to add the role based polices

    I have added the helm repository and updated the helm using below commands

    helm repo add prometheus-community [https://prometheus-community.github.io/helm-charts](https://prometheus-community.github.io/helm-charts)
    

    enter image description here

    Installed the Prometheus using below command

    helm install prometheus prometheus-community/kube-prometheus-stack -n namespace_name
    

    enter image description here

    I have configured the Prometheus and Grafana and exposed to port 9090 using port forward

    kubectl port-forward -n prometheus prometheus-prometheus-kube-prometheus-prometheus-0 9090
    

    To login to grafana dashboard username and password should require

    I have followed the some commands to get the username and password, usually admin name and password are in encrypted format we can decode using base64

    kubectl get secret -n namespace_name Prometheus-grafana -o=sonpath=[{.data.admin-user}'|base64 -d
    kubectl get secret -n namespace_name Prometheus-grafana -o=sonpath=[{.data.admin-password}'|base64 -d
    

    enter image description here

    I have done the local port forwarding for Grafana

    kubectl port-forward -n prometheus prometheus-grafana-55b48f4cf9-rzkgv(pod_name) 3000
    

    When I open localhost:3000 and login with username and password I am able to see the Grafana dashboard

    enter image description here

    If we use role based polices we can able to access the azure metrics for particular service area

    You can find the commands list for reference below

    enter image description here