Deploy the LMA Light observability stack on MicroK8s

Metadata
Key Value
Summary Deploy the LMA Light observability stack on MicroK8s.
Categories deploy-applications
Difficulty 2
Author Leon Mintz

Introduction

Duration: 1:00

The LMA Light bundle is a Juju-based observability stack consisting of Prometheus, Loki, Alertmanager and Grafana.

This tutorial assumes you have a JuJu controller bootstrapped on a MicroK8s cloud that is ready to use. A typical setup using snaps can be found in the Juju docs. Follow the instructions there to install Juju and MicroK8s.

Let’s go and deploy that bundle!

Deploy the LMA bundle

Duration: 5:00

Before deploying anything you must have a Juju model. It is usually a good idea to create a dedicated model for the LMA bundle. So let’s do just that and call the new model lma:

juju add-model lma
juju switch lma

Next, deploy the bundle with:

juju deploy lma-light \
  --channel=edge \
  --trust

Now you can sit back and watch the deployment take place:

juju status \
  --relations \
  --color \
  --watch 2s

The status of your deployment should eventually be very similar to the following:

> juju status --relations
Model  Controller  Cloud/Region        Version  SLA          Timestamp
lma    lma-uk8s    microk8s/localhost  2.9.15   unsupported  16:53:38-00:00

App            Version  Status  Scale  Charm                         Store     Channel  Rev  OS          Address         Message
alertmanager            active      1  alertmanager-k8s              charmhub  edge       6  kubernetes  10.152.183.175  
grafana                 active      1  grafana-k8s                   charmhub  edge      10  kubernetes  10.152.183.156  
loki                    active      1  loki-k8s                      charmhub  edge       6  kubernetes  10.152.183.6    
prometheus              active      1  prometheus-k8s                charmhub  edge      10  kubernetes  10.152.183.227  

Unit              Workload  Agent  Address     Ports  Message
alertmanager/0*   active    idle   10.1.24.70         
grafana/0*        active    idle   10.1.24.71         
loki/0*           active    idle   10.1.24.82         
prometheus/0*     active    idle   10.1.24.73         

Relation provider               Requirer                                Interface              Type     Message
alertmanager:alerting           prometheus:alertmanager                 alertmanager_dispatch  regular  
alertmanager:replicas           alertmanager:replicas                   alertmanager_replica   peer     
grafana:grafana-peers           grafana:grafana-peers                   grafana_peers          peer     
loki:grafana-source             grafana:grafana-source                  grafana_datasource     regular  
prometheus:grafana-source       grafana:grafana-source                  grafana_datasource     regular  

Now LMA Light is good to go: you can relate software with it to begin the monitoring!

Alternatively, you may want to deploy the bundle with one or more of our readily available overlays, which is what we’ll cover next.

Deploy the LMA bundle with overlays

Duration: 2:00

An overlay is a set of model-specific modifications that avoid repetitive overhead in setting up bundles like LMA Light.

Specifically, we offer the following overlays:

You can apply the offers overlay do an existing LMA Light bundle by executing the juju deploy command. The storage-small overlay, however, is applicable only on the first deployment. So, if you were following the previous steps you would first need to switch to a new Juju model or remove all applications from the current one.

To use any of the overlays above, you need to include an --overlay argument per overlay (applied in order):

curl -L https://raw.githubusercontent.com/canonical/lma-light-bundle/main/overlays/offers-overlay.yaml -O
curl -L https://raw.githubusercontent.com/canonical/lma-light-bundle/main/overlays/storage-small-overlay.yaml -O

juju deploy lma-light \
  --trust
  --channel=edge \
  --overlay ./offers-overlay.yaml \
  --overlay ./storage-small-overlay.yaml

Browse dashboards

Duration: 2:00

When all the charms are deployed you can head over to browse their built-in web-UIs. You can find out their addresses from juju status, which should have a section similar to:

Unit              Workload  Agent  Address     Ports  Message
alertmanager/0*   active    idle   10.1.24.70         
grafana/0*        active    idle   10.1.24.71         
loki/0*           active    idle   10.1.24.82         
prometheus/0*     active    idle   10.1.24.73         

In this case, the dashboards would be something like:

  • http://10.1.24.70:9093, for alertmanager
  • http://10.1.24.71:3000, for grafana
  • http://10.1.24.73:9090, for prometheus

(Note: the IP addresses are almost certainly going to be different in your case.)

Enjoy!

That’s all folks!

Congrats, you made it! You should now be able to easily:

  • deploy the LMA Light observability stack
  • augment the LMA Light bundle file with ready-made overlays
  • find the URLs of the web-UI dashboards

Next steps

  • Use the scrape target charm to have the LMA stack scrape any open-metrics target.
  • Relate your own charm to the LMA stack with relation interfaces such as prometheus_scrape.
  • If you need support, the charmhub community is the best place to get all your questions answered and get in touch with the community.

Further readings


Last updated 8 days ago.