Skip to content

Commit

Permalink
Add Loki documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
seanmorton committed Jun 21, 2023
1 parent 7ce3c7c commit 04f7757
Show file tree
Hide file tree
Showing 2 changed files with 53 additions and 3 deletions.
51 changes: 51 additions & 0 deletions gitops/components/loki/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
# Loki
Loki is a logging aggregator from Grafana labs. It has native support in Grafana as a data source.

This configuration deploys Loki in `singleBinary` mode (monolithic style), using S3 for log storage.

## Required Variables
* `LOKI_GATEWAY_HOST`: The hostname of the loki gateway ingress
* `LOKI_ROLE_ARN`: The role ARN to attach to the loki service account
* `LOKI_S3_BUCKET`: The name of the loki log storage bucket

## Required Secrets
A secret named `loki-basic-auth` in the `loki` namespace, which contains the basic auth credentials for the Loki gateway. See [this tutorial](https://kubernetes.github.io/ingress-nginx/examples/auth/basic/) for an example on how to generate such a secret.

## Required AWS Resources
* An S3 bucket for log storage
* IAM policy for the `loki` service account:
```json
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": [
"s3:ListBucket",
"s3:PutObject",
"s3:GetObject",
"s3:DeleteObject"
],
"Resource": [
"arn:aws:s3:::{LOKI_S3_BUCKET}",
"arn:aws:s3:::{LOKI_S3_BUCKET}/*"
]
}
]
}
```
* If using grafana, a data source for Loki:
```hcl
resource "grafana_data_source" "loki" {
provider = grafana.amg
type = "loki"
name = "loki"
url = "{LOKI_GATEWAY_HOST}"
basic_auth_enabled = true
basic_auth_username = "admin"
secure_json_data_encoded = jsonencode({
basicAuthPassword = var.LOKI_BASIC_AUTH_PASSWD
})
}
```
5 changes: 2 additions & 3 deletions gitops/components/loki/resources.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -92,9 +92,8 @@ spec:
ingressClassName: "nginx"
annotations:
cert-manager.io/cluster-issuer: letsencrypt
# TODO setup auth
# nginx.ingress.kubernetes.io/auth-type: basic
# nginx.ingress.kubernetes.io/auth-secret: loki-basic-auth
nginx.ingress.kubernetes.io/auth-type: basic
nginx.ingress.kubernetes.io/auth-secret: loki-basic-auth
hosts:
- host: loki.example.com
paths:
Expand Down

0 comments on commit 04f7757

Please sign in to comment.