Install Grafana
Deployment
Let’s deploy Grafana to read data from Prometheus instances.
This will be simple. In our monitoring
directory, create a new subdirectory called grafana
, and in it, we will create following files:
grafana-pvc.yaml
This will be our persistent storage, it’s to keep the dashboards saved. As far as I understand it, Grafana does not keep the data, so we don't have to have so much space dedicated to it (mine is using like 400 MB).
grafana-deployment.yaml
Fairly standard deployment, I mentioned most of the "kinks" I use before, like nodeSelector
etc...
grafana-serviceAccount.yaml
Just a service account for Grafana.
grafana-service.yaml
Classic for us by now: I'm creating external IP for Grafana to run on 192.168.0.206, and port 3000.
Jump one folder up, and apply to the whole folder:
Check if Grafana pod is deployed:
Basic setup
You should be able to connect to the IP of Grafana now.
Default login and password is admin:admin

Then, go down and change your account name, password etc...

Next, we need to define the source where Grafana should look for data.

Click on Add data source
and choose Prometheus
, a new tab with settings will pop up. Set a name for your instance, for example Prometheus-main
. This is so we can differentiate sources later. The next important value is URL
. If you remember, back when we deployed the Prometheus file prometheus-service-local.yaml
, we created ClusterIP, and in another file, MetalLB IP. You can choose any of them. To check look at the services:
So, in the URL
either put IP or NAME, so for example, using internal ClusterIP, entering http://10.43.108.243:9090
should work. You can also use prometheus-external:9090
or 192.168.0.205:9090
.
At the bottom click Save & Test
. It should check and save the data source.
Add another data source. This will be for OpenFaaS (if you have it). Same drill as above, just check your IP for OpenFaaS Prometheus.
So use 10.43.98.240:9090
for URL
, and name it Prometheus-OpenFaaS, or something that will let you know it’s OpenFaaS data.
prometheus
, therefore I opt for IP instead of http://prometheus:9090
, as I'm not sure if the internal DNS would mess something up.Some Graphs
My final goal is to create my own dashboard with data I want. But before we get to that, we can use an already existing collection (and later pick and choose what we want from them).
Click on the plus sign and then Import:

Next, type 8171
into Import via grafana.com
.

Where did I get the ID? Well, here: Grafana Dashboard.
Click Load
.
In the next window, name the dashboard if you like, but more importantly, choose the source for your main Prometheus instance.

Click Import
.
Tadaaaa! Your first graphs. It should take you to them immediately, and you can choose data from a specific server on the top.

Here is a list of other dashboards that work, mostly, out of the box.
And that’s really it. In the next chapter, we are going to add logging of logs to Grafana. Logging