Loki Coordinator K8S
- Canonical Observability
Channel | Revision | Published | Runs on |
---|---|---|---|
latest/edge | 7 | 18 Nov 2024 | |
latest/edge | 1 | 12 Aug 2024 |
juju deploy loki-coordinator-k8s --channel edge
Deploy Kubernetes operators easily with Juju, the Universal Operator Lifecycle Manager. Need a Kubernetes cluster? Install MicroK8s to create a full CNCF-certified Kubernetes system in under 60 seconds.
Platform:
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 ‘monolithic’ version of loki
, where a single worker node is assigned all the roles. 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 monolithic-loki
with Juju
juju add-model monolithic-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-worker --channel=edge --config role-all=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.monolithic-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-worker
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).