Deconstructing Prometheus

Christian Frank
3 min readJun 12, 2022

--

Even though SUSE Rancher includes an operator-based Prometheus installation in the Apps Marketplace, it can be beneficial to manually install a complete Prometheus/Loki/Grafana stack.

All configuration files below have been copied and adapted from the respective Github repositories and follow their published licenses.

State Metrics

An essential tool for Kubernetes metrics is kube-state-metrics, which we will install first:

kube-state-metrics depends on the Kubernetes version; check here to deploy the correct version.

Prometheus

The next piece of software we’ll install is Prometheus to collect Kubernetes metrics:

The number of alerts and rules is at a bare minimum. If you want to install the Kubernetes mixin dashboards, include the additional rules and alerts in the configuration.

Node exporter

To get metrics from the underlying nodes, we’ll install the node exporter:

As the node exporters come online, Prometheus will start scraping their endpoints.

Loki

Next, we’ll install Loki to store the Kubernetes logs:

The ruler is activated to keep the installation simple, but no rules are defined.

Grafana

Now that we have the data sources, we’ll install Grafana for analysis:

Grafana 8 does not yet allow for automatic provisioning of notifiers for Unified Alerting; this is planned for Grafana 9 and tracked in Issue #39510.

Unified Alerting works fine, so we do not install Alertmanager anymore.

Syslog forwarding

Prometheus will start scraping metrics automatically, but for the logs, we will need to configure Rancher’s logging operator:

Navigation Link

As a finishing touch, we will put navigation links to Grafana into the Rancher UI:

Dashboards

The installation above includes no dashboards except for the Home dashboard.

To view the Kubernetes State metrics, try dashboard 13332:

For a start at log file analysis, try dashboard 12019:

Another good source for dashboards is the built-in Rancher dashboards in the cattle-dashboards namespace or the various available mixins.

You could consider adding Tempo to the installation if you want to include application tracing for a full observability stack.

All files are available on my Github, in Rancher/aks-cluster/grafana.

Happy Ranching!

--

--

Christian Frank
Christian Frank

Written by Christian Frank

Christian is a senior Lead Solution Consultant in the Cloud and Datacenter automation space with many years of experience in IT Transformation