Loki-coordinator-k8s docs - distributed deployment

Table of Contents

This tutorial uses the abstraction of the coordinator class in the Loki Coordinator charm in tandem with the Loki Worker charm. We will deploy the ‘distributed’ version of loki, where each worker node is assigned one of the required roles for a coherent Loki deployment. For alternative deployment modes and a migration guide, refer to this other doc.

Deploy Loki Coordinator and Worker

First, we will create a model called distributed-loki with Juju

juju add-model distributed-loki

Then, we will deploy the coordinator and worker Loki applications

juju deploy loki-coordinator-k8s loki --channel=edge --trust
juju deploy loki-worker-k8s loki-read --channel=edge --config role-read=True --trust
juju deploy loki-worker-k8s loki-write --channel=edge --config role-write=True --trust
juju deploy loki-worker-k8s loki-backend --channel=edge --config role-backend=True --trust

We recommend naming your loki-coordinator-k8s app "loki" as that is the single entry point to the Loki deployment as a whole: you will never have to interact with the worker nodes directly.

Deploy Storage

Loki uses object storage for storing logs and the charm consequently requires an S3 or Ceph integration. We can use Loki HA with an external s3 by deploying the s3-integrator!

However, for this tutorial we will use minio (refer to set-up-minio-for-s3-testing for more information and automation about the storage setup).

juju deploy minio --channel=stable --trust --config access-key="AccessKey" --config secret-key="SecretKey"
juju deploy s3-integrator s3 --channel stable --trust

After the services are in active/idle state (juju status --watch 1s), configure the s3 charm

juju run s3/leader sync-s3-credentials access-key=AccessKey secret-key=SecretKey
juju config s3 endpoint="http://minio-0.minio-endpoints.distributed-loki.svc.cluster.local:9000"

We need to create a bucket with Minio, but first we need the application IP.

juju status | grep "^minio" | awk '{print $8}'

Log into the Minio console by navigating to

http://<MINIO_IP>:9001

and replacing <MINIO_IP> with the previous result.

If you are running Juju within a VM, you need to add an IP route to be able to access the app UI from your host’s browser.

Authenticate with:

  • User: AccessKey
  • Password: SecretKey

Now we can create a bucket called loki in the UI:

Integrate Charms

juju relate loki s3
juju relate loki loki-read
juju relate loki loki-write
juju relate loki loki-backend

Finally, we can wait for the deployment to become active/idle (this may take some time) with

juju status --watch 1s

and the resulting model status should look like:

The coordinator is reporting ‘Degraded’ because the number of worker units are less than the recommended amount (see this open bug for progress on making the status message more informative).

1 Like