Prometheus

  • By Balbir Thomas
juju deploy prometheus-k8s --channel edge
Show information
You will need Juju 2.9 to be able to run this command. Learn how to upgrade to Juju 2.9.
Channel Version Revision Published Base
latest/edge 11 11 Today
20.04

Platform:

About

Prometheus for Kubernetes clusters Read more


Relevant links


Discuss this charm

Share your thoughts on this charm with the community on discourse.

Join the discussion

Prometheus Operator

Description

The Prometheus Operator provides a cluster monitoring solution using Prometheus, which is an open source monitoring system and alerting toolkit.

This repository contains a Juju Charm for deploying the monitoring component of Prometheus in a Kubernetes cluster. An alerting service for Prometheus is offered through a separate Charm.

Usage

The Prometheus Operator may be deployed using the Juju command line as in

$ juju deploy prometheus-k8s

By default the Prometheus Operator monitors itself, but it also accepts additional scrape targets over Juju relations with charms that support the prometheus_scrape interface and preferably use the Prometheus charm library. This charm library provides an add_endpoint() method that creates additional scrape targets. Each scrape target is expected to expose a /metrics HTTP path that exposes its metrics in a Prometheus compatible format. For example, the kube-state-metrics charm integrates with the Prometheus K8S charm in a way that allows you import metrics about resources in a Kubernetes cluster by doing:

$ juju deploy kube-state-metrics
$ juju relate kube-state-metrics prometheus-k8s

In a similar manner any charm that exposes a scrape target may be related to the Prometheus charm.

At present it is expected that all relations the Prometheus Operator partakes in are within the same Juju model. Further development may extend this to allow cross model scrape targets.

Dashboard

The Prometheus dashboard may be accessed at a configurable port (by default 9090) on the IP address of the Prometheus unit. This unit and its IP address may be determined using the juju status command.

Relations

Currently supported relations are

  • Grafana aggregates metrics scraped by Prometheus and provides a versatile dashboard to view these metrics in configurable ways. Prometheus relates to Grafana over the grafana_datasource interface.
  • Alertmanager receives alerts from Prometheus, aggregates and deduplicates them, then forwards them to specified targets. Prometheus relates to Alertmanager over the alertmanager interface.
  • Access to Prometheus from outside the Kubernetes cluster can be provided via ingress relation with the Nginx Ingress Integrator. This relation is experimental, and there is a chance the charm will evolve to use some other mechanism to be reachable from the outside of the hosting Kubernetes cluster.
  • In addition, this Prometheus charm allows relations with any charm that supports the prometheus_scrape relation.
  • This Prometheus charm does not as yet support federation. This implies scaling the number of Prometheus units results in each unit scrape the same targets.

Use Cases Supported

  • Configure scrape targets through Juju relations.
  • Configure alerting rules through relations with scrape target charms.
  • Enable alert forwarding through a relation with Alertmanager.
  • Support metrics visualisation through Grafana.

OCI Images

This charm by default uses the latest version of the ubuntu/prometheus image.