Grafana is open-source software that allows you to visualize and analyze metrics data collected by Prometheus on your clusters. Tanzu Kubernetes Grid includes a Grafana package that you can deploy on your Tanzu Kubernetes clusters. In this post, I will explain the steps to deploy Grafana on a Tanzu Kubernetes (workload) cluster. For more detailed, refer to official doc
- Bootstrap machine with the following installed: Tanzu CLI, kubectl installed as mentioned here
- Tanzu Kubernetes Grid management cluster and workload cluster running on vSphere, Amazon EC2, or Azure, with the package repository installed. For this demo, I have deployed TKG on Azure.
- Cert-manager: click here to get the detailed steps to install cert-manager packages from TMC
- Contour: click here to get the detailed steps to install Contour packages from TMC
- Prometheus: click here to get the detailed steps to install Prometheus
Prepare config file:
- Set the content to workload cluster and fetch the Grafana package version:
- Create a yaml file with below config and name it as storageclass.yaml. In this demo, I will be using node local storage
- Edit the generated config file: grafana-data-values.yaml to change the values as shown below
- I have changed the fqdn to prometheus.workshop.captainvirtualization.in and added certificate, key
- Added encoded admin password using the command: echo -n “Welcome11!” | base64
- Changed StorageClassName from null to name (local-storage) mentioned in above storageclass.yaml file
- Create a persistent volume
Note: Login to worker node(s) of workload cluster and create empty directory pv3 under /data/volumes/ and also provide the host name(s) under values in below file.
- Create a DNS record in hosted zone or local host file (/etc/hosts), by mapping the fqdn provided in grafana-data-values.yaml to above collected load balancer IP.
- Access the prometheus fqdn in browser
- Credentials as mentioned in grafana-data-values.yaml file : Admin, Welcome11!
- Once successfully logged in, navigate to Add (+) > Import as shown below
- Type 3119 and click Load
- Verify the name and same can be changed too and select Prometheus from drop down of prometheus section
- Here you go, the amazing grafana dashboards showing the resource utilisation of nodes, pods etc.. which can be customised in many different ways.