Others: Grafana Upgrade
Table Of Content
Grafana Upgrade
Prometheus/Grafana Setup
Prerequisite
Kubernetes service is already installed in the Azure environment.
Require VPN Connection (Perimeter for Onshore, SSL VPN Client for Offshore) to access the Azure cluster from your local laptop
Require Admin permission of local machine to install Azure CLI, Helm & Kubectl (Provided by Ashfaque for Offshore and by IT Tech Support for Onshore)
Require Azure AKS access credential from the IT administrator (Setup for individual user by Infrastructure Administrator)
A decompression tool like WinRAR, 7Zip is required to be preinstalled to unzip .tar files
Monitoring Tool - Grafana
kube-prometheus-stack collects Kubernetes manifests, Grafana dashboards, and Prometheus rules combined with documentation and scripts to provide easy to operate end-to-end Kubernetes cluster monitoring with Prometheus using the Prometheus Operator.
Prometheus collects all the matrics in backend and Grafana presents User interface, both work collectively to provide monitoring.
Grafana - Grafana is a pictorial representation of your data.
Prometheus - Prometheus collects and stores its metrics as time series data, i.e. metrics information is stored with the timestamp at which it was recorded, alongside optional key-value pairs called labels.
Follow the Deployment steps below:
Open the following link:
kube-prometheus-stack 69.3.1 · prometheus/prometheus-community
Choose the Install option, screenshot below.
Screenshot below:
Follow the below steps.
Run the following command to Add repository: helm repo add prometheus-community Prometheus Community Kubernetes Helm Charts
b. Run the following command to update repository: Helm repo update
c, Run the following command to install the Prometheus: helm install grafana-prometheus prometheus-community/kube-prometheus-stack --version 35.2.0 -n monitoring
Here, Iis the new namespace monitoring
Note: In the above command the highlighted word is just a release name that could be anything.
Run the following command to see the services and pods of kube-prometheus-stack deployment.
Kubectl get svc -n monitoring
Follow the below instructions to access Grafana in browser:
Run the following command to edit grafana-prometheus deployment file.
kubectl edit service [name of deployment] -n [namespace]
e.g: kubectl edit service grafana-prometheus -n monitoring
Yaml file of deployment will be opened.
Note - To access the Grafana page directly from the browser need to change ClusterIP to LoadBalancer so that external IP of the service can be used for direct access.
b. Replace ClusterIP with LoadBalancer in type and save.
c. By default it will be ClusterIP
d. Save this file the change will be applied automatically and the service will generate external IP, see highlighted in screenshot below.
Note: Incase change will not applied or don’t generate external IP then Run the following command to restart deployment :
kubectl rollout restart deployment grafana-prometheus -n monitoring
e. Copy external IP and Open in browser URL.
f. Screenshot below.
g. Use default Login credentials for Garfana.
i. User: admin
ii. Password: prom-operator
Home Page Screenshot below :
Open Browser highlighted in the above screenshot.
Scroll down and select the Namespace dashboard, Screenshot below.
Select the Namespace, Screenshot below.
All data will be shown in the dashboard .
Service Monitor - It monitor specific service and pods of the service which is having match label app/ kubernetes.io/name: event
Upgrading Grafana on Debian/Ubuntu
Stop Grafana Service:
bash
Copy code
sudo systemctl stop grafana-server
Update the Package Repository:
Ensure that the package repository information is up to date.
bash
Copy code
sudo apt-get update
Upgrade Grafana:
Install the latest version of Grafana.
bash
Copy code
sudo apt-get install -y grafana
Start Grafana Service:
Restart the Grafana service to apply the upgrade.
Copy code
sudo systemctl start grafana-server
Check Grafana Service Status:
Verify that Grafana is running correctly.
Copy code
sudo systemctl status grafana-server