Skip to content
Juju Charm/Operator for Prometheus on Kubernetes
Python Makefile
Branch: master
Clone or download

Latest commit

Fetching latest commit…
Cannot retrieve the latest commit at this time.


Type Name Latest commit message Commit time
Failed to load latest commit information.

Juju Charm/Operator for Prometheus on Kubernetes

CI Badges

Click on each badge for more details.

Branch Build Status Coverage
master Build Status (master) Coverage Status

Quick Start

git submodule update --init --recursive
sudo snap install juju --classic
sudo snap install microk8s --classic
sudo microk8s.enable dns dashboard registry storage
sudo usermod -a -G microk8s $(whoami)

Log out then log back in so that the new group membership is applied to your shell session.

juju bootstrap microk8s mk8s

Optional: Grab coffee/beer/tea or do a 5k run. Once the above is done, do:

juju create-storage-pool operator-storage kubernetes storage-class=microk8s-hostpath
juju add-model lma
juju deploy . --resource prometheus-image=prom/prometheus:latest

Wait until juju status shows that the prometheus app has a status of active.

Preview the Prometheus GUI


kubectl -n prometheus port-forward svc/prometheus 9090:9090

The above assumes you're using the default value for advertised-port. If you customized this value from 9090 to some other value, change the command above accordingly.

Now browse to http://localhost:9090/

The default prometheus.yml includes a configuration that scrapes metrics from Prometheus itself. Execute the following query to show TSDB stats:


For more info on getting started with Prometheus see its official getting started guide.

Use Prometheus as a Grafana Datasource

Refer to the Grafana Operator Quick Start guide to learn how to use Prometheus with Grafana.

Running the Unit Tests on Your Workstation

To run the test using the default interpreter as configured in tox.ini, run:


If you want to specify an interpreter that's present in your workstation, you may run it with:

tox -e py37

To view the coverage report that gets generated after running the tests above, run:

make coverage-server

The above command should output the port on your workstation where the server is listening on. If you are running the above command on Multipass, first get the Ubuntu VM's IP via multipass list and then browse to that IP and the abovementioned port.

NOTE: You can leave that static server running in one session while you continue to execute tox on another session. That server will pick up any new changes to the report automatically so you don't have to restart it each time.

Relying on More Comprehensive Unit Tests

To ensure that this charm is tested on the widest number of platforms possible, we make use of Travis CI which also automatically reports the coverage report to a publicly available page. To get a view of what the state of each relevant branch is, click on the appropriate badges found at the top of this README.


Much of how this charm is architected is guided by the following classic references. It will do well for future contributors to read and take them to heart:

  1. Hexagonal Architecture by Alistair Cockburn
  2. Boundaries (Video) by Gary Bernhardt
  3. Domain Driven Design (Book) by Eric Evans
You can’t perform that action at this time.