Monitoring how much resources your server(s) and how much resources your apps are using is easier then ever with Prometheus and Grafana. In this tutorial i will show you how to do this on a Kubernetes cluster.
To make this as easy as possible I created a Helm chart that deploys Prometheus and Grafana together, it uses local storage instead of a volume from a cloud vendor. The only preperations you need to do is create the directories on the Kubernetes node you plan to deploy this on.
I created this because i use K3S for some of my Kubernetes setups and I run them on non cloud vendors, so this is perfect for that, “On-prem” servers or vendors that dont have cloud volumes.
SSH into the server you plan to deploy Prometheus & Grafana too.
Create the directories needed, paths for this can be changed to whatever you supply in
$ mkdir -p /myvolumes/prometheus/alertmanager
$ mkdir -p /myvolumes/prometheus/pushgateway
$ mkdir -p /myvolumes/prometheus/server
Clone this repo to your computer (not the server): https://github.com/pixelpiloten/prometheus
Deploy the helm chart.
$ helm install --name pixelpiloten_prometheus . -f values.yaml
Check that all the pods for Prometheus and Grafana are deployed and up and running.
$ kubectl -n monitoring get pods
Create a port-forward to the Grafana Service, port 8080 can be whatever port you want.
$ kubectl -n monitoring port-forward svc/grafana 8080:80
Now you can access the Grafana web GUI in your browser.
You now have installed Prometheus and Grafana and can get started creating Dashboards or import existing ones from https://grafana.com/grafana/dashboards to monitor everything from your Kubernetes nodes and applications running in it.