Skip to content

canonical/mimir-bundle

Repository files navigation

Mimir bundle

Table of Contents

Mimir is an Open Source, horizontally scalable, highly available, multi-tenant TSDB for long-term storage for Prometheus.

Mimir is a single binary that can be configured to run in several modes to take up different roles in the ingestion/storage/read pipeline, such as distributor, compactor and so on, read the official docs for a more detailed explanation..

Charmed Mimir consists of two charms, a coordinator and a worker.

The coordinator is responsible for creating the configuration files for each worker and deciding whether the cluster is in a coherent state, based on the roles that each worker has adopted.

Several worker applications can be deployed and related to the coordinator, taking on different roles and enabling independent scalability of the various components of the stack.

The coordinator charm acts as single access point for bundle-level integrations such as TLS, ingress, self-monitoring, etc..., and as single source of truth for bundle-level configurations that otherwise would have to be repeated (and kept in sync) between the individual worker nodes.

This Juju bundle deploys Mimir and a small object storage server, consisting of the following interrelated charmed operators:

This bundle is under development. Join us on:

Usage

Before deploying the bundle you may want to create a dedicated model for Mimir components:

juju add-model mimir

The bundle deploys Mimir in its monolithic mode, which runs all required components in a single process and is the default mode of operation. Monolithic mode is the simplest way to deploy Grafana Mimir and is useful if you want to get started quickly or want to work with Grafana Mimir in a development environment.

tox -e render-bundle -- bundle.yaml
juju deploy ./bundle.yaml --trust

The bundle will deploy:

  • 3 mimir-worker units (mimir-worker-k8s charm)
  • 1 coordinator unit (mimir-coordinator-k8s charm)
  • 1 s3-integrator unit (s3-integrator charm)

[note] The default number of worker units is an odd number to prevent split-brain situations, and greater than 1 for the deployment to be HA. [/note]

Advanced deployment modes

Mimir can also be deployed distributing the roles across units freely. This includes for example the experimental read/write deployment mode. You can achieve this (or any other allocation of roles) by deploying the components manually:

juju deploy mimir-coordinator-k8s mimir
juju deploy mimir-worker-k8s mimir-read --config query-frontend=true --config querier=true
juju deploy mimir-worker-k8s mimir-write --config distributor=true --config ingester=true
juju deploy mimir-worker-k8s mimir-backend --config store-gateway=true --config compactor=true --config ruler=true --config alertmanager=true --config query-scheduler=true --config overrides-exporter=true
juju deploy s3-integrator

juju relate mimir mimir-read
juju relate mimir mimir-write
juju relate mimir mimir-backend
juju relate mimir s3-integrator

Overlays

We also make available some overlays for convenience:

  • the cos-relations overlay establishes relationships between the charms in this bundle and those in the cos-lite bundle, as well as exposing Mimir as a Prometheus compatible remote-write targets as a Juju offer which may be used to set up a cross-model relation.
  • the storage-small overlays provides a (small) setup of the various storages for the Mimir bundle charms. Using an overlay for storage is fundamental for a production deployment, as you cannot change the amount of storage assigned to the various charms after the bundle is deployed.

In order to use the overlays above, you need to:

  1. Download the overlays (or clone the repository)
  2. Pass the --overlay <path-to-overlay-file-1> --overlay <path-to-overlay-file-2> ... arguments to the juju deploy command

For example, to deploy the COS Lite bundle, then the Mimir bundle with the cos-relations overlay, you would do the following:

curl -L https://raw.githubusercontent.com/canonical/mimir-bundle/main/overlays/cos-relations-overlay.yaml -O
juju deploy cos-lite-bundle --channel=edge --trust

juju deploy mimir-bundle --channel=edge --trust --overlay ./cos-relations-overlay.yaml
./render_bundle.py bundle.yaml --channel=edge
charmcraft pack
charmcraft upload mimir-bundle.zip
charmcraft release mimir-bundle --channel=edge --revision=1